[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Org Agenda - revert all agenda files?
From: |
Nick Dokos |
Subject: |
Re: [O] Org Agenda - revert all agenda files? |
Date: |
Wed, 25 Jul 2012 11:39:00 -0400 |
Christer Boräng <address@hidden> wrote:
> In message <address@hidden>
> , Xin Shi writes:
> >Hello Experts,
>
> >In the *Org Agenda* buffer, I usually use the key "r" to refresh the
> >content. If some of the agenda files have change from the disk, it will pop
> >up the question in the mini-buffer to ask what to do. As I choose "r" to
> >revert most of the time, and I have to do several times to revert all the
> >related agenda files. I'm wondering if there is a command to revert all
> >agenda files? Or "force revert"?
>
> Hi.
>
> You could do what I do and run global-auto-revert-mode.
>
There are times when you might wish that you didn't use this: I have on
some occasions mangled a file outside of emacs, but I still had the
buffer with the all-important contents in emacs, so I was able to avert
catastrophe: iiuc, global auto-revert would revert the buffer from the
file on disk, eliminating the possibility of undoing the mistake.
On the OP's question, I'd prefer a more targeted solution: something
like this should work (very lightly tested - check the doc for
revert-without-query if you want to modify the regexp):
--8<---------------cut here---------------start------------->8---
(defun xin-shi-org-revert-agenda-buffers ()
(interactive)
(mapcar
(lambda (file)
(let ((revert-without-query '(".*\.org$")))
(find-file file)
(revert-buffer)))
org-agenda-files))
--8<---------------cut here---------------end--------------->8---
Nick