* org-agenda-show-current-time-in-grid and automatic refresh
@ 2011-01-12 3:23 Kiwon Um
2011-01-12 7:19 ` Suvayu Ali
2011-01-12 7:58 ` Detlef Steuer
0 siblings, 2 replies; 11+ messages in thread
From: Kiwon Um @ 2011-01-12 3:23 UTC (permalink / raw)
To: emacs-orgmode
Dear org users,
The recent function for showing current time in agenda view is quite
cool. I have a question about it. When the agenda view is being shown,
is there any way to refresh it automatically so that makes the current
time line always recent?
Thanks.
--
Kiwon Um
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: org-agenda-show-current-time-in-grid and automatic refresh
2011-01-12 3:23 Kiwon Um
@ 2011-01-12 7:19 ` Suvayu Ali
2011-01-12 8:23 ` Nick Dokos
2011-01-18 9:58 ` Carsten Dominik
2011-01-12 7:58 ` Detlef Steuer
1 sibling, 2 replies; 11+ messages in thread
From: Suvayu Ali @ 2011-01-12 7:19 UTC (permalink / raw)
To: Kiwon Um; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 986 bytes --]
Hi Kiwon,
On Wed, 12 Jan 2011 12:23:48 +0900
Kiwon Um <um.kiwon@gmail.com> wrote:
> Dear org users,
>
> The recent function for showing current time in agenda view is quite
> cool. I have a question about it. When the agenda view is being shown,
> is there any way to refresh it automatically so that makes the current
> time line always recent?
>
I have thought about that, I even worked up a small minor mode for that
(attached). But it doesn't seem to work very well. It updates only the
first time but fails subsequently. I am still a lisp newbie. If someone
could guide me, I could give it another try.
Right now it only updates if any of the agenda file buffers change but I
would also like to put a timer. Then if no agenda files have been edited
in a while (say 5 mins) the agenda buffer is refreshed anyway. But I
don't know how to do that. Any suggestions would be welcome.
> Thanks.
>
Thanks
> --
> Kiwon Um
--
Suvayu
Open source is the future. It sets us free.
[-- Attachment #2: 0001-Implement-org-agenda-refresh-mode-minor-mode.patch --]
[-- Type: text/x-patch, Size: 1878 bytes --]
From 82a240bd0af7ac4e7e59357777bf38892972f4c7 Mon Sep 17 00:00:00 2001
From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
Date: Tue, 11 Jan 2011 23:17:08 -0800
Subject: [PATCH] Implement org-agenda-refresh-mode minor mode
* lisp/org-agenda.el: (org-agenda-refresh-mode) New minor
mode to auto-refresh the agenda buffer
(org-agenda-refresh-changed) The function used to refresh
the Agenda buffer
Issue: updates only the first time.
---
lisp/org-agenda.el | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index bf36758..d5f11eb 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6780,6 +6780,31 @@ if it was hidden in the outline."
(org-back-to-heading)
(recenter n)))
+(defvar org-agenda-refresh-mode)
+(defvar org-agenda-refresh-changed-buffers nil)
+
+(define-minor-mode org-agenda-refresh-mode
+ "Turn on refresh for Agenda buffer."
+ nil nil nil
+ (unless (derived-mode-p 'org-agenda-mode)
+ (error "Not in an Org Agenda buffer"))
+ (frame-or-buffer-changed-p 'org-agenda-refresh-changed-buffers)
+ (add-hook 'post-command-hook 'org-agenda-refresh-changed))
+
+(defun org-agenda-refresh-changed ()
+ "Update Org Agenda buffer."
+ (interactive)
+ (when (frame-or-buffer-changed-p 'org-agenda-refresh-changed-buffers)
+ (let* ((agenda-buf (get-buffer "*Org Agenda*")))
+ (dolist (buf (org-buffer-list 'agenda))
+ (ignore-errors
+ (if (and (buffer-modified-p buf)
+ (with-current-buffer buf (eq 'org-mode major-mode)))
+ (with-current-buffer agenda-buf
+ (when (and org-agenda-refresh-mode
+ (derived-mode-p 'org-agenda-mode))
+ (org-agenda-redo)))))))))
+
(defvar org-agenda-cycle-counter nil)
(defun org-agenda-cycle-show (&optional n)
"Show the current entry in another window, with default settings.
--
1.7.3.4
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: org-agenda-show-current-time-in-grid and automatic refresh
2011-01-12 3:23 Kiwon Um
2011-01-12 7:19 ` Suvayu Ali
@ 2011-01-12 7:58 ` Detlef Steuer
1 sibling, 0 replies; 11+ messages in thread
From: Detlef Steuer @ 2011-01-12 7:58 UTC (permalink / raw)
To: emacs-orgmode
Hi!
Just in case you missed the simple "g" in agenda view to update the
view with a single keypress.
Not automatic, but nearly.
It took me a long time to discover these single key commands, so may
be someone else finds a reminder useful, too.
Detlef
On Wed, 12 Jan 2011 12:23:48 +0900
Kiwon Um <um.kiwon@gmail.com> wrote:
> Dear org users,
>
> The recent function for showing current time in agenda view is quite
> cool. I have a question about it. When the agenda view is being shown,
> is there any way to refresh it automatically so that makes the current
> time line always recent?
>
> Thanks.
>
> --
> Kiwon Um
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: org-agenda-show-current-time-in-grid and automatic refresh
2011-01-12 7:19 ` Suvayu Ali
@ 2011-01-12 8:23 ` Nick Dokos
2011-01-12 21:33 ` Suvayu Ali
2011-01-18 9:58 ` Carsten Dominik
1 sibling, 1 reply; 11+ messages in thread
From: Nick Dokos @ 2011-01-12 8:23 UTC (permalink / raw)
To: Suvayu Ali; +Cc: nicholas.dokos, emacs-orgmode, Kiwon Um
Suvayu Ali <fatkasuvayu+linux@gmail.com> wrote:
> Hi Kiwon,
>
> On Wed, 12 Jan 2011 12:23:48 +0900
> Kiwon Um <um.kiwon@gmail.com> wrote:
>
> > Dear org users,
> >
> > The recent function for showing current time in agenda view is quite
> > cool. I have a question about it. When the agenda view is being shown,
> > is there any way to refresh it automatically so that makes the current
> > time line always recent?
> >
>
> I have thought about that, I even worked up a small minor mode for that
> (attached). But it doesn't seem to work very well. It updates only the
> first time but fails subsequently. I am still a lisp newbie. If someone
> could guide me, I could give it another try.
>
> Right now it only updates if any of the agenda file buffers change but I
> would also like to put a timer. Then if no agenda files have been edited
> in a while (say 5 mins) the agenda buffer is refreshed anyway. But I
> don't know how to do that. Any suggestions would be welcome.
>
You can probably use run-with-timer or run-with-idle-timer to do things
like this, but I'm with Detlef Steuer: pressing 'g' in the agenda to
refresh it is simple and does not consume any extra resources - you do
it when you need to and it's done. I just find the idea of running a
timer in order to update a time line in the agenda every once in a while
somewhat distasteful, but maybe it's just me.
OTOH, I'm being somewhat hypocritical here because I run two visible
clocks: one in the gnome panel and one in the emacs mode line with
display-time. Having three of them however is clearly overkill :-)
Nick
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: org-agenda-show-current-time-in-grid and automatic refresh
2011-01-12 8:23 ` Nick Dokos
@ 2011-01-12 21:33 ` Suvayu Ali
2011-01-13 4:56 ` Kiwon Um
0 siblings, 1 reply; 11+ messages in thread
From: Suvayu Ali @ 2011-01-12 21:33 UTC (permalink / raw)
To: nicholas.dokos; +Cc: emacs-orgmode, Kiwon Um
Hi Nick,
On Wed, 12 Jan 2011 03:23:44 -0500
Nick Dokos <nicholas.dokos@hp.com> wrote:
> You can probably use run-with-timer or run-with-idle-timer to do
> things like this, but I'm with Detlef Steuer: pressing 'g' in the
> agenda to refresh it is simple and does not consume any extra
> resources - you do it when you need to and it's done. I just find the
> idea of running a timer in order to update a time line in the agenda
> every once in a while somewhat distasteful, but maybe it's just me.
Thanks for the hint. I tried it, works fine. But on reflecting on it
some more, I agree with you seems an overkill specially when a simple g
does the job.
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: org-agenda-show-current-time-in-grid and automatic refresh
@ 2011-01-13 1:43 Tommy Stanton
2011-01-13 8:41 ` Sébastien Vauban
0 siblings, 1 reply; 11+ messages in thread
From: Tommy Stanton @ 2011-01-13 1:43 UTC (permalink / raw)
To: Suvayu Ali; +Cc: nicholas.dokos, emacs-orgmode, Kiwon Um
[-- Attachment #1.1: Type: text/plain, Size: 397 bytes --]
I would guess that the simple use of 'g' for refreshing was inspired by the
Emacs buffer list (induced by C-c C-b; you enter "Buffer Menu" mode while in
that *Buffer List* buffer's window).
Discovering 'g' for the buffer list took me a long time, but I was so
delighted when I did.
-Tommy
On Jan 12, 2011 1:33 PM, "Suvayu Ali"
<fatkasuvayu+linux@gmail.com<fatkasuvayu%2Blinux@gmail.com>>
wrote:
[-- Attachment #1.2: Type: text/html, Size: 536 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: org-agenda-show-current-time-in-grid and automatic refresh
2011-01-12 21:33 ` Suvayu Ali
@ 2011-01-13 4:56 ` Kiwon Um
2011-01-13 6:36 ` Michael Brand
2011-01-15 11:35 ` Bastien
0 siblings, 2 replies; 11+ messages in thread
From: Kiwon Um @ 2011-01-13 4:56 UTC (permalink / raw)
To: Suvayu Ali; +Cc: nicholas.dokos, emacs-orgmode
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> Hi Nick,
>
> On Wed, 12 Jan 2011 03:23:44 -0500
> Nick Dokos <nicholas.dokos@hp.com> wrote:
>
>> You can probably use run-with-timer or run-with-idle-timer to do
>> things like this, but I'm with Detlef Steuer: pressing 'g' in the
>> agenda to refresh it is simple and does not consume any extra
>> resources - you do it when you need to and it's done. I just find the
>> idea of running a timer in order to update a time line in the agenda
>> every once in a while somewhat distasteful, but maybe it's just me.
>
> Thanks for the hint. I tried it, works fine. But on reflecting on it
> some more, I agree with you seems an overkill specially when a simple g
> does the job.
Thanks. Here is my hack for it. It works fine.
;; in the emacs init file
;; refresh agenda view regurally
(defun kiwon/org-agenda-redo-in-other-window ()
"Call org-agenda-redo function even in the non-agenda buffer."
(interactive)
(let ((agenda-window (get-buffer-window org-agenda-buffer-name t)))
(when agenda-window
(with-selected-window agenda-window (org-agenda-redo)))))
(run-at-time nil 300 'kiwon/org-agenda-redo-in-other-window)
--
Kiwon Um
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: org-agenda-show-current-time-in-grid and automatic refresh
2011-01-13 4:56 ` Kiwon Um
@ 2011-01-13 6:36 ` Michael Brand
2011-01-15 11:35 ` Bastien
1 sibling, 0 replies; 11+ messages in thread
From: Michael Brand @ 2011-01-13 6:36 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Detlef Steuer, Tommy Stanton, Kiwon Um, Nick Dokos
On Thu, Jan 13, 2011 at 05:56, Kiwon Um <um.kiwon@gmail.com> wrote:
> ;; refresh agenda view regurally
> (defun kiwon/org-agenda-redo-in-other-window ()
> "Call org-agenda-redo function even in the non-agenda buffer."
> (interactive)
> (let ((agenda-window (get-buffer-window org-agenda-buffer-name t)))
> (when agenda-window
> (with-selected-window agenda-window (org-agenda-redo)))))
> (run-at-time nil 300 'kiwon/org-agenda-redo-in-other-window)
I must admit that I would like and use a less simple solution where
only the line with the current time would be updated and if necessary
also moved within the time grid once every minute. I would like it
even additionally to the clock on the OS desktop because the agenda
view current time does not only show the current time itself but also
the current time position within the time grid.
For me it would not be desirable to update also all other agenda view
contents like above without request from the user with `g'. On one
side because it can collide badly with the user while manipulating (e.
g. shift-right several times on an entry) or only moving in the agenda
view and on one side because an overall update can take an
unpredictably large amount of CPU time for a larger set of larger
agenda files.
Michael
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: org-agenda-show-current-time-in-grid and automatic refresh
2011-01-13 1:43 org-agenda-show-current-time-in-grid and automatic refresh Tommy Stanton
@ 2011-01-13 8:41 ` Sébastien Vauban
0 siblings, 0 replies; 11+ messages in thread
From: Sébastien Vauban @ 2011-01-13 8:41 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Tommy,
Tommy Stanton wrote:
> I would guess that the simple use of 'g' for refreshing was inspired by the
> Emacs buffer list (induced by C-c C-b; you enter "Buffer Menu" mode while in
> that *Buffer List* buffer's window).
>
> Discovering 'g' for the buffer list took me a long time, but I was so
> delighted when I did.
... as well in Dired and in Gnus.
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: org-agenda-show-current-time-in-grid and automatic refresh
2011-01-13 4:56 ` Kiwon Um
2011-01-13 6:36 ` Michael Brand
@ 2011-01-15 11:35 ` Bastien
1 sibling, 0 replies; 11+ messages in thread
From: Bastien @ 2011-01-15 11:35 UTC (permalink / raw)
To: Kiwon Um; +Cc: emacs-orgmode, nicholas.dokos
Hi Kiwon,
Kiwon Um <um.kiwon@gmail.com> writes:
> ;; refresh agenda view regurally
> (defun kiwon/org-agenda-redo-in-other-window ()
> "Call org-agenda-redo function even in the non-agenda buffer."
> (interactive)
> (let ((agenda-window (get-buffer-window org-agenda-buffer-name t)))
> (when agenda-window
> (with-selected-window agenda-window (org-agenda-redo)))))
> (run-at-time nil 300 'kiwon/org-agenda-redo-in-other-window)
I added this to org-hacks.org, thanks!
--
Bastien
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: org-agenda-show-current-time-in-grid and automatic refresh
2011-01-12 7:19 ` Suvayu Ali
2011-01-12 8:23 ` Nick Dokos
@ 2011-01-18 9:58 ` Carsten Dominik
1 sibling, 0 replies; 11+ messages in thread
From: Carsten Dominik @ 2011-01-18 9:58 UTC (permalink / raw)
To: Suvayu Ali; +Cc: emacs-orgmode, Kiwon Um
Hi,
I believe this is superseded by the hack in org-hacks.org, so I have
marked this patch off on the patchwork server.
- Carsten
On Jan 12, 2011, at 8:19 AM, Suvayu Ali wrote:
> Hi Kiwon,
>
> On Wed, 12 Jan 2011 12:23:48 +0900
> Kiwon Um <um.kiwon@gmail.com> wrote:
>
>> Dear org users,
>>
>> The recent function for showing current time in agenda view is quite
>> cool. I have a question about it. When the agenda view is being
>> shown,
>> is there any way to refresh it automatically so that makes the
>> current
>> time line always recent?
>>
>
> I have thought about that, I even worked up a small minor mode for
> that
> (attached). But it doesn't seem to work very well. It updates only the
> first time but fails subsequently. I am still a lisp newbie. If
> someone
> could guide me, I could give it another try.
>
> Right now it only updates if any of the agenda file buffers change
> but I
> would also like to put a timer. Then if no agenda files have been
> edited
> in a while (say 5 mins) the agenda buffer is refreshed anyway. But I
> don't know how to do that. Any suggestions would be welcome.
>
>> Thanks.
>>
>
> Thanks
>
>> --
>> Kiwon Um
>
> --
> Suvayu
>
> Open source is the future. It sets us free.
> <0001-Implement-org-agenda-refresh-mode-minor-
> mode.patch>_______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-01-18 9:58 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-13 1:43 org-agenda-show-current-time-in-grid and automatic refresh Tommy Stanton
2011-01-13 8:41 ` Sébastien Vauban
-- strict thread matches above, loose matches on Subject: below --
2011-01-12 3:23 Kiwon Um
2011-01-12 7:19 ` Suvayu Ali
2011-01-12 8:23 ` Nick Dokos
2011-01-12 21:33 ` Suvayu Ali
2011-01-13 4:56 ` Kiwon Um
2011-01-13 6:36 ` Michael Brand
2011-01-15 11:35 ` Bastien
2011-01-18 9:58 ` Carsten Dominik
2011-01-12 7:58 ` Detlef Steuer
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).