From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Org Agenda - revert all agenda files? Date: Thu, 26 Jul 2012 09:27:05 +0200 Message-ID: <231F203A-2C16-4EF8-98E5-9ED5513D7AB0@gmail.com> References: <10429.1343213540@chalmers.se> <3886.1343230740@alphaville> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:56430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuITa-0007hi-BO for emacs-orgmode@gnu.org; Thu, 26 Jul 2012 03:27:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SuITW-0003SK-Aj for emacs-orgmode@gnu.org; Thu, 26 Jul 2012 03:27:14 -0400 Received: from ezel.ic.uva.nl ([146.50.108.158]:57177) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuITW-0003SB-1z for emacs-orgmode@gnu.org; Thu, 26 Jul 2012 03:27:10 -0400 In-Reply-To: <3886.1343230740@alphaville> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: nicholas.dokos@hp.com Cc: Orgmode , Xin Shi , =?us-ascii?Q?Christer_=3D=3Futf-8=3FQ=3FBor=3DC3=3DA4ng=3F=3D?= On 25 jul 2012, at 17:39, Nick Dokos wrote: > Christer Bor=E4ng wrote: >=20 >> In message = >> , Xin Shi writes: >>> Hello Experts, >>=20 >>> 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"? >>=20 >> Hi. >>=20 >> You could do what I do and run global-auto-revert-mode. >>=20 >=20 > 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. >=20 > 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): >=20 > --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--- The variable org-agenda-files can also contain directories. Therefore you should use the function call (org-agenda-files t) to get a list of the files. The t means, even if the agenda is currently restricted, get all files. Another improvement to this function would be to limit it to files currently visited - but I guess this is a minor issue as the next agenda command will visit all those files anyway. - Carsten >=20 > Nick >=20 - Carsten