From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
To: Kiwon Um <um.kiwon@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-agenda-show-current-time-in-grid and automatic refresh
Date: Tue, 11 Jan 2011 23:19:09 -0800 [thread overview]
Message-ID: <20110111231909.2338897e@bhishma.homelinux.net> (raw)
In-Reply-To: <87fwsyyfcr.fsf@gmail.com>
[-- 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
next prev parent reply other threads:[~2011-01-12 7:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-12 3:23 org-agenda-show-current-time-in-grid and automatic refresh Kiwon Um
2011-01-12 7:19 ` Suvayu Ali [this message]
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
-- strict thread matches above, loose matches on Subject: below --
2011-01-13 1:43 Tommy Stanton
2011-01-13 8:41 ` Sébastien Vauban
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110111231909.2338897e@bhishma.homelinux.net \
--to=fatkasuvayu+linux@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=um.kiwon@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.