From: Derek Feichtinger <dfeich@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: whether in drawer?
Date: Thu, 28 Apr 2016 05:38:33 +0000 (UTC) [thread overview]
Message-ID: <loom.20160428T073630-585@post.gmane.org> (raw)
In-Reply-To: CAJcAo8u-E1DSPZvcQB5JNP2bZvGFw2A8HKym1Dr142QaAJKk8Q@mail.gmail.com
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
next prev parent reply other threads:[~2016-04-28 5:38 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 [this message]
2016-04-28 6:00 ` Samuel Wales
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=loom.20160428T073630-585@post.gmane.org \
--to=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).