From mboxrd@z Thu Jan 1 00:00:00 1970 From: Derek Feichtinger Subject: Re: PATCH: invoking RET on agenda clock log line ends up with point in closed clock drawer Date: Sun, 1 May 2016 12:49:15 +0200 Message-ID: References: <87inyyy8kx.fsf@saiph.selenimh> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114abf968fbcb10531c5a08b Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1awowc-0002WT-Tn for emacs-orgmode@gnu.org; Sun, 01 May 2016 06:49:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1awowQ-0007nz-UH for emacs-orgmode@gnu.org; Sun, 01 May 2016 06:49:41 -0400 Received: from mail-io0-x235.google.com ([2607:f8b0:4001:c06::235]:34592) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1awowP-0007jy-KP for emacs-orgmode@gnu.org; Sun, 01 May 2016 06:49:34 -0400 Received: by mail-io0-x235.google.com with SMTP id 190so140200319iow.1 for ; Sun, 01 May 2016 03:49:19 -0700 (PDT) In-Reply-To: <87inyyy8kx.fsf@saiph.selenimh> 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 , emacs-orgmode@gnu.org --001a114abf968fbcb10531c5a08b Content-Type: text/plain; charset=UTF-8 Hi Nicolas Thanks for the fast fix and also for the pointers to interesting functions. Regards, Derek On Sun, May 1, 2016 at 1:34 AM, Nicolas Goaziou wrote: > Hello, > > Derek Feichtinger writes: > > > A longer time ago, hitting RET on an agenda clock log line brought up the > > respective org buffer with the cursor positioned on the clock line. At > some > > point this stopped to work cleanly, at least when using clock drawers. > The > > clock drawer would always be closed (even when it was opened in the org > > buffer before jumping.) with the cursor being in the hidden drawer. So, > it > > became impossible to find the target clock line for e.g. modifying it. > > This is fixed. Thank you. > > > ;; when jumping to the agenda from a log message, the point ends up at > > ;; a CLOCK item in a LOGBOOK drawer, but the drawer gets closed, even > > ;; if the drawer was open before. I add a drawer opening function to > > ;; the respective agenda hook > > (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))) > > See `org-element-lineage'. > > > (when element > > (let ((pos (point))) > > (goto-char (org-element-property :begin element)) > > (org-flag-drawer nil) > > (goto-char pos))))) > > > > (add-hook 'org-agenda-after-show-hook #'org-open-if-in-drawer) > > Hooks are for user convenience, as you used it; I don't think any core > feature should be > implemented through hooks. > > Note that you can also call `org-flag-drawer' on a specific drawer using > optional argument. > > > Regards, > > -- > Nicolas Goaziou > --001a114abf968fbcb10531c5a08b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Nicolas

Thanks for the fast fix and = also for the pointers to interesting functions.

Re= gards,
Derek

On Sun, May 1, 2016 at 1:34 AM, Nicolas Goaziou <ma= il@nicolasgoaziou.fr> wrote:
dfeich@gmail.com<= /a>> writes:

> A longer time ago, hitting RET on an agenda clock log line brought up = the
> respective org buffer with the cursor positioned on the clock line. At= some
> point this stopped to work cleanly, at least when using clock drawers.= The
> clock drawer would always be closed (even when it was opened in the or= g
> buffer before jumping.) with the cursor being in the hidden drawer. So= , it
> became impossible to find the target clock line for e.g. modifying it.=

This is fixed. Thank you.

> ;; when jumping to the agenda from a log message, the point ends up at=
> ;; a CLOCK item in a LOGBOOK drawer, but the drawer gets closed, even<= br> > ;; if the drawer was open before. I add a drawer opening function to > ;; the respective agenda hook
> (defun org-open-if-in-drawer ()
>=C2=A0 =C2=A0(let ((element (org-element-at-point)))
>=C2=A0 =C2=A0 =C2=A0(while (and element
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(not (memq (org-= element-type element)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 '(drawer property-drawer))))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(setq element (org-element-property :parent = element)))

See `org-element-lineage'.

>=C2=A0 =C2=A0 =C2=A0(when element
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(let ((pos (point)))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char (org-element-property :begin elem= ent))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(org-flag-drawer nil)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char pos)))))
>
> (add-hook 'org-agenda-after-show-hook #'org-open-if-in-drawer)=

Hooks are for user convenience, as you used it; I don't think any core = feature should be
implemented through hooks.

Note that you can also call `org-flag-drawer' on a specific drawer usin= g
optional argument.


Regards,

--
Nicolas Goaziou

--001a114abf968fbcb10531c5a08b--