emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] PATCH: invoking RET on agenda clock log line ends up with point


From: Nicolas Goaziou
Subject: Re: [O] PATCH: invoking RET on agenda clock log line ends up with point in closed clock drawer
Date: Sun, 01 May 2016 01:34:38 +0200

Hello,

Derek Feichtinger <address@hidden> 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



reply via email to

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