emacs-orgmode
[Top][All Lists]
Advanced

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

Re: One vs many directories


From: Ihor Radchenko
Subject: Re: One vs many directories
Date: Thu, 26 Nov 2020 11:47:53 +0800

> For my own setup I run code in a hook to update the agenda whenever I
> change a TODO state, clock in or clock out, but that has performance
> problems when I do it while the Agenda is shown.

You do not have or update the whole agenda view.

I use the following code to update the clocking highlights in agenda
even when I clock-in/out outside the agenda buffer:

https://github.com/yantar92/emacs-config/blob/master/config.org#update-highlight-from-currently-clocked-task-in-agenda-even-if-the-task-was-clocked-inout-from-outside

The same can be done for todo state changes using
org-agenda-change-all-lines

Best,
Ihor

"Dr. Arne Babenhauserheide" <arne_bab@web.de> writes:

> Jean Louis <bugs@gnu.support> writes:
>
>> Some people maybe access multiple Org files through Agenda, me I
>> don't. Some items are "non existent" and I do not know how to ask
>> agenda to refresh itself.
>
> Simply press the letter g.
>
> For my own setup I run code in a hook to update the agenda whenever I
> change a TODO state, clock in or clock out, but that has performance
> problems when I do it while the Agenda is shown.
>
>     (defvar todo-modified-from-agenda nil "Indicates whether org-mode todo 
> state changes were triggered from the agenda. Check this to avoid trying to 
> propagate the change back into the agenda")
>     ;; continuously update agenda view, from 
> http://thomasf.github.io/solarized-css/test/org-hacks.html
>     (defun kiwon/org-agenda-redo-in-other-window ()
>       "Call org-agenda-redo function even in the non-agenda buffer."
>       (interactive)
>       (when (not (and (boundp 'todo-modified-from-agenda) 
> todo-modified-from-agenda)) ; org-state non-nil means we’re coming from the 
> org-after-todo-state-change-hook, which would throw when changing todo states 
> from agenda due to a circular action
>         (let ((agenda-window (get-buffer-window (or (and (boundp 
> 'org-agenda-buffer-name) org-agenda-buffer-name) "plan.org") t)))
>           (when agenda-window
>       (with-selected-window agenda-window
>         (org-agenda-redo))))))
>     ;; advice agenda todo to avoid redo, thanks to 
> http://nullprogram.com/blog/2013/01/22/
>     (defadvice org-agenda-todo (before org-agenda-disable-redo activate)
>       (setq todo-modified-from-agenda t))
>     (defadvice org-agenda-todo (after org-agenda-enable-redo activate)
>       (setq todo-modified-from-agenda nil))
>     
>     (add-hook 'org-clock-in-hook 'kiwon/org-agenda-redo-in-other-window)
>     (add-hook 'org-clock-out-hook 'kiwon/org-agenda-redo-in-other-window)
>     (add-hook 'org-after-todo-state-change-hook 
> 'kiwon/org-agenda-redo-in-other-window)
>
>
> Best wishes,
> Arne
> -- 
> Unpolitisch sein
> heißt politisch sein
> ohne es zu merken



reply via email to

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