From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Wales Subject: Re: whether in drawer? Date: Wed, 27 Apr 2016 23:00:39 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avf0E-0002rn-7Y for emacs-orgmode@gnu.org; Thu, 28 Apr 2016 02:00:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avf0D-0001E4-0H for emacs-orgmode@gnu.org; Thu, 28 Apr 2016 02:00:42 -0400 Received: from mail-vk0-x235.google.com ([2607:f8b0:400c:c05::235]:34027) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avf0C-0001Du-Q1 for emacs-orgmode@gnu.org; Thu, 28 Apr 2016 02:00:40 -0400 Received: by mail-vk0-x235.google.com with SMTP id m188so19891241vka.1 for ; Wed, 27 Apr 2016 23:00:40 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Derek Feichtinger Cc: emacs-orgmode@gnu.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 wrote: > Hi > > Samuel Wales 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.