Christer Boräng <m...@chalmers.se> wrote: > In message > <CAJN7d86LrDuFQibeTCh3g-WvgTk75ituqXccVf=y1qdvwpp...@mail.gmail.com> > , 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