emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Samuel Wales <samologist@gmail.com>
To: Derek Feichtinger <dfeich@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: whether in drawer?
Date: Wed, 27 Apr 2016 23:00:39 -0700	[thread overview]
Message-ID: <CAJcAo8u-TGNA+UUD2Tg0Vytd5Zj5KNpiRgYLc9z45WOGs9R_6Q@mail.gmail.com> (raw)
In-Reply-To: <loom.20160428T073630-585@post.gmane.org>

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 <dfeich@gmail.com> 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	other threads:[~2016-04-28  6:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-28  2:49 whether in drawer? Samuel Wales
2016-04-28  5:38 ` Derek Feichtinger
2016-04-28  6:00   ` Samuel Wales [this message]
2016-04-28 14:52     ` Adam Porter
2016-04-28 19:43       ` Samuel Wales

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJcAo8u-TGNA+UUD2Tg0Vytd5Zj5KNpiRgYLc9z45WOGs9R_6Q@mail.gmail.com \
    --to=samologist@gmail.com \
    --cc=dfeich@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).