From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: Re: Showing Property in headline; generating table from properties; exporting table to CSV Date: Thu, 6 Aug 2015 12:26:22 -0400 Message-ID: References: <87k2t8k64x.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1134bbc6e2500a051ca6fabc Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60742) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNNzt-0000UT-3o for emacs-orgmode@gnu.org; Thu, 06 Aug 2015 12:26:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZNNzr-0000nQ-NI for emacs-orgmode@gnu.org; Thu, 06 Aug 2015 12:26:25 -0400 Received: from mail-ig0-x22c.google.com ([2607:f8b0:4001:c05::22c]:35622) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNNzr-0000mh-HR for emacs-orgmode@gnu.org; Thu, 06 Aug 2015 12:26:23 -0400 Received: by igr7 with SMTP id 7so14590848igr.0 for ; Thu, 06 Aug 2015 09:26:23 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode --001a1134bbc6e2500a051ca6fabc Content-Type: text/plain; charset=UTF-8 On Thu, Aug 6, 2015 at 10:06 AM, John Kitchin wrote: > You could do something with overlays like this: > > #+BEGIN_SRC emacs-lisp > (require 'ov) > > (org-map-entries > (lambda () > (when (org-entry-get (point) "GRADE") > (setq ov (make-overlay (+ 0 (line-end-position)) > (+ 1 (line-end-position)))) > (overlay-put > ov 'display > (format " grade: %s\n" (org-entry-get (point) "GRADE")))))) > #+END_SRC > > #+RESULTS: > | nil | grade: 10\n | grade: 20\n | grade: 30\n | nil | grade: 40\n | > grade: 50\n | grade: 60\n | > > #+BEGIN_SRC emacs-lisp > (ov-clear) > #+END_SRC > > > The final \n in the overlay is a little irritating when the buffer is folded, as it adds an extra line between the headlines. I changed it this, which doesn't seem perfect but so far works for me: #+BEGIN_SRC emacs-lisp :results output (require 'ov) (org-map-entries (lambda () (when (org-entry-get (point) "GRADE") (setq ov (make-overlay (- (line-end-position) 1) (+ 0 (line-end-position)))) (setq character (buffer-substring (- (line-end-position) 1) (line-end-position))) (overlay-put ov 'display (format "%s GRADE: %s" character (org-entry-get (point) "GRADE")))))) #+END_SRC you need to run this to refresh the grades on the headlines when they > change. The TODO state is a good indication of which ones are done, > although they do not show the grades. > so I should probably make this into a function which can be called by the function that writes grades... > > > Eric S Fraga writes: > > > On Thursday, 6 Aug 2015 at 07:24, Matt Price wrote: > > > > [...] > > > >> - I currently store my grades as properties of level-2 headlines. > However, > >> I would really like to be able to see the grades when the headline is > >> folded, so I can have a quick visual sense of how many papers I've > marked, > > > > I would like something like this as well. The nearest I have found is > > to use column view. > > -- > Professor John Kitchin > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu > --001a1134bbc6e2500a051ca6fabc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Thu, Aug 6, 2015 at 10:06 AM, John Kitchin <jkitchin@andrew.c= mu.edu> wrote:
You could do= something with overlays like this:

#+BEGIN_SRC emacs-lisp
(require 'ov)

(org-map-entries
=C2=A0(lambda ()
=C2=A0 =C2=A0(when (org-entry-get (point) "GRADE")
=C2=A0 =C2=A0 =C2=A0(setq ov (make-overlay (+ 0 (line-end-position))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (+ 1 (line-end-position))))
=C2=A0 =C2=A0 =C2=A0(overlay-put
=C2=A0 =C2=A0 =C2=A0 ov 'display
=C2=A0 =C2=A0 =C2=A0 (format=C2=A0 " grade: %s\n" (org-entry-get = (point) "GRADE"))))))
#+END_SRC

#+RESULTS:
| nil | grade: 10\n | grade: 20\n | grade: 30\n | nil | grade: 40\n | grade= : 50\n | grade: 60\n |

#+BEGIN_SRC emacs-lisp
(ov-clear)
#+END_SRC



The final \n in the overlay is a littl= e irritating when the buffer is folded, as it adds an extra line between th= e headlines.=C2=A0 I changed it this, which doesn't seem perfect but so= far works for me:

#+BEGIN_SRC emacs-lisp :results output
=C2=A0 = (require 'ov)

=C2=A0 (org-map-entries
=C2=A0=C2=A0 (lambda ()=
=C2=A0=C2=A0=C2=A0=C2=A0 (when (org-entry-get (point) "GRADE"= )
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (setq ov (make-overlay (- (line-e= nd-position) 1)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (+ 0 (line-end-position))))=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (setq character (buffer-substring (-= (line-end-position) 1) (line-end-position)))
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (overlay-put
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ov = 'display
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (format=C2=A0 &q= uot;%s=C2=A0 GRADE: %s" character (org-entry-get (point) "GRADE&q= uot;))))))
#+END_SRC

you need to run this to refresh the grades on the headlines when they
change. The TODO state is a good indication of which ones are done,
although they do not show the grades.

s= o I should probably make this into a function which can be called by the fu= nction that writes grades... =C2=A0


Eric S Fraga writes:

> On Thursday,=C2=A0 6 Aug 2015 at 07:24, Matt Price wrote:
>
> [...]
>
>> - I currently store my grades as properties of level-2 headlines. = However,
>> I would really like to be able to see the grades when the headline= is
>> folded, so I can have a quick visual sense of how many papers I= 9;ve marked,
>
> I would like something like this as well.=C2=A0 The nearest I have fou= nd is
> to use column view.

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

--001a1134bbc6e2500a051ca6fabc--