emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Showing Property in headline; generating table from properties;


From: Matt Price
Subject: Re: [O] Showing Property in headline; generating table from properties; exporting table to CSV
Date: Thu, 6 Aug 2015 12:26:22 -0400



On Thu, Aug 6, 2015 at 10:06 AM, John Kitchin <address@hidden> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]