[Top][All Lists]

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

Re: [O] whether in drawer?

From: Samuel Wales
Subject: Re: [O] whether in drawer?
Date: Wed, 27 Apr 2016 23:00:39 -0700

thank you.  for years i have been trying to advise undo-tree to deal
with visibility properly.  namely, to not try to undo or redo
invisibly, but also not to leave too much stuff visible.  maybe if i
can get it to do canonical visibility except in drawers (where it
should keep the drawer open if point is in it) it will work properly.

On 4/27/16, Derek Feichtinger <address@hidden> wrote:
> Hi
> Samuel Wales <samologist <at> gmail.com> writes:
>> can one tell whether point is in a drawer?
> By coincidence just posted a patch request which contains the functionality
> you desire. I use org-element-at-point and then test for drawer/property
> drawer:
> (defun org-open-if-in-drawer ()
>   (let ((element (org-element-at-point)))
>     (while (and element
>               (not (memq (org-element-type element)
>                          '(drawer property-drawer))))
>       (setq element (org-element-property :parent element)))
>     (when element
>       (let ((pos (point)))
>       (goto-char (org-element-property :begin element))
>       (org-flag-drawer nil)
>       (goto-char pos)))))
> Cheers,
> Derek

The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.

reply via email to

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