emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* modifying/deleting ovelrays; also, un-sparsifying tree?
@ 2016-07-29 14:31 Matt Price
  2016-07-29 14:46 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Price @ 2016-07-29 14:31 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 2237 bytes --]

In my gradesheets I use overlays to display the grade property in headlines
-- that way I can see at a glance approximately how my students are doing:

;; still imperfect, but good enough for me.
(defun org-grading-overlay-headings ()
  "Show grades at end of headlines that have a 'GRADE' property."
  (interactive)
  (require 'ov)

  (org-map-entries
   (lambda ()
     (when (org-entry-get (point) "GRADE")
       (ov-clear (- (line-end-position) 1)
                 (+ 0 (line-end-position)))
       (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 CHITS: %s" character (org-entry-get (point)
"GRADE") (org-entry-get (point) "CHITS")))
       (overlay-put ov 'name "grading")
       (message "%s" (overlay-get ov "name")))))
  )

This mostly works, except that I've noticed that, when I regenerate the
overlays after changes, certain folded trees end up with a duplicate
overlay, for reasons that I don't quite understand (maybe because the
ellipses at the end of the fold interfere with my counting somehow)?
I ould like to be able to find the named overlays and remove them all at
once, something like this:

(defun matt-clear-overlay ()
  (interactive)
  (let ((all-overlays (overlays-in (point-min) (point-max))))
    (dolist (x all-overlays)
      (if (string= (overlay-get x "name") "grading")
          (delete-overlay x)
          )))) ;; sorry for hanging brackets, I know it's bad form

this doesn't seem to do anything, so maybe I'm not testing right, or I'm
misnderstanding overlays. In any case ,I would love to be able to locate
the overlays properly, and modify or delete-and-recreate them
appropriately. Can you guys help out? Just clearing all overlays is not a
good option, as org seems to make heavy use of them to hide e.g. property
drawers.

An unrelated simple question: if I make a sparse tree (e.g. by searching
for all subtrees with a "GRADE" property of "0" or "FAIL",), can i
un-sparsify hte buffer afterwards? I didn't immediately find that option in
the manual.

thanks everyone!
matt

[-- Attachment #2: Type: text/html, Size: 2779 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: modifying/deleting ovelrays; also, un-sparsifying tree?
  2016-07-29 14:31 modifying/deleting ovelrays; also, un-sparsifying tree? Matt Price
@ 2016-07-29 14:46 ` Nicolas Goaziou
  2016-07-29 15:31   ` Matt Price
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2016-07-29 14:46 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

Matt Price <moptop99@gmail.com> writes:

> In my gradesheets I use overlays to display the grade property in headlines
> -- that way I can see at a glance approximately how my students are doing:
>
> ;; still imperfect, but good enough for me.
> (defun org-grading-overlay-headings ()

Why don't you use column view instead?

> An unrelated simple question: if I make a sparse tree (e.g. by searching
> for all subtrees with a "GRADE" property of "0" or "FAIL",), can i
> un-sparsify hte buffer afterwards? I didn't immediately find that option in
> the manual.

See `org-reveal' or `org-cycle'.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: modifying/deleting ovelrays; also, un-sparsifying tree?
  2016-07-29 14:46 ` Nicolas Goaziou
@ 2016-07-29 15:31   ` Matt Price
  2016-07-29 16:21     ` Matt Price
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Price @ 2016-07-29 15:31 UTC (permalink / raw)
  To: Matt Price, Org Mode

[-- Attachment #1: Type: text/plain, Size: 951 bytes --]

On Fri, Jul 29, 2016 at 10:46 AM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Matt Price <moptop99@gmail.com> writes:
>
> > In my gradesheets I use overlays to display the grade property in
> headlines
> > -- that way I can see at a glance approximately how my students are
> doing:
> >
> > ;; still imperfect, but good enough for me.
> > (defun org-grading-overlay-headings ()
>
> Why don't you use column view instead?
>

um.  because...  um.... I guess I had some reason a year ago when I
designed this system. Looking at it again today, column view looks great...

>
> > An unrelated simple question: if I make a sparse tree (e.g. by searching
> > for all subtrees with a "GRADE" property of "0" or "FAIL",), can i
> > un-sparsify hte buffer afterwards? I didn't immediately find that option
> in
> > the manual.
>
> See `org-reveal' or `org-cycle'.
>
org-reveal is what I'm looking for, thank you!

>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 1809 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: modifying/deleting ovelrays; also, un-sparsifying tree?
  2016-07-29 15:31   ` Matt Price
@ 2016-07-29 16:21     ` Matt Price
  2016-07-29 22:31       ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Price @ 2016-07-29 16:21 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 915 bytes --]

On Fri, Jul 29, 2016 at 11:31 AM, Matt Price <moptop99@gmail.com> wrote:

>
>
> On Fri, Jul 29, 2016 at 10:46 AM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
> wrote:
>
>> Matt Price <moptop99@gmail.com> writes:
>>
>> > In my gradesheets I use overlays to display the grade property in
>> headlines
>> > -- that way I can see at a glance approximately how my students are
>> doing:
>> >
>> > ;; still imperfect, but good enough for me.
>> > (defun org-grading-overlay-headings ()
>>
>> Why don't you use column view instead?
>>
>
> um.  because...  um.... I guess I had some reason a year ago when I
> designed this system. Looking at it again today, column view looks great...
>

small question: Is it possible to get one or more columns to always line up
o nthe right hand side of the buffer? Or to assign a width to the first
column (in my case the item name) that is somehting like "buffer-width
minus 30"?



>
>

[-- Attachment #2: Type: text/html, Size: 1866 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: modifying/deleting ovelrays; also, un-sparsifying tree?
  2016-07-29 16:21     ` Matt Price
@ 2016-07-29 22:31       ` Nicolas Goaziou
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2016-07-29 22:31 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

Matt Price <moptop99@gmail.com> writes:

> small question: Is it possible to get one or more columns to always line up
> o nthe right hand side of the buffer? Or to assign a width to the first
> column (in my case the item name) that is somehting like "buffer-width
> minus 30"?

No, it isn't.

Regards,

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-29 22:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-29 14:31 modifying/deleting ovelrays; also, un-sparsifying tree? Matt Price
2016-07-29 14:46 ` Nicolas Goaziou
2016-07-29 15:31   ` Matt Price
2016-07-29 16:21     ` Matt Price
2016-07-29 22:31       ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).