From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xin Shi Subject: Re: Org Agenda - revert all agenda files? Date: Mon, 30 Jul 2012 13:26:43 +0200 Message-ID: References: <10429.1343213540@chalmers.se> <3886.1343230740@alphaville> <231F203A-2C16-4EF8-98E5-9ED5513D7AB0@gmail.com> <51FFFFFB-B4DC-47BC-84C8-34A1D5A8F250@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d042f91a8e8d10c04c60a57ac Return-path: Received: from eggs.gnu.org ([208.118.235.92]:36715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Svo8A-0000Wm-UV for emacs-orgmode@gnu.org; Mon, 30 Jul 2012 07:27:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Svo83-0007lw-3D for emacs-orgmode@gnu.org; Mon, 30 Jul 2012 07:27:22 -0400 Received: from mail-gg0-f169.google.com ([209.85.161.169]:55716) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Svo82-0007lp-TB for emacs-orgmode@gnu.org; Mon, 30 Jul 2012 07:27:15 -0400 Received: by ggm4 with SMTP id 4so5539434ggm.0 for ; Mon, 30 Jul 2012 04:27:14 -0700 (PDT) In-Reply-To: <51FFFFFB-B4DC-47BC-84C8-34A1D5A8F250@gmail.com> 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: =?ISO-8859-1?Q?Christer_Bor=E4ng?= , Orgmode , Carsten Dominik --f46d042f91a8e8d10c04c60a57ac Content-Type: text/plain; charset=ISO-8859-1 Dear all, Thanks for your kind reply! Sorry that I didn't have chance to check till now. OKay, I added the function: (defun sx-org-revert-agenda-buffers () (interactive) (mapcar (lambda (file) (let ((revert-without-query '(".*\.org$"))) (find-file file) (revert-buffer))) (org-agenda-files t))) It works ! Thanks a lot! Xin On Thu, Jul 26, 2012 at 11:32 PM, Carsten Dominik wrote: > Carsten Dominik wrote: > > > > > On 25 jul 2012, at 17:39, Nick Dokos wrote: > > > >> ... > >> 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--- > > > > > > 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. > > > > Thanks - I forgot all about that. > > > 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. > > > > Yes, I thought about that and decided it wasn't worth worrying about. > As Kernighan and Plauger say: first get it right, then make it fast; and > as we just saw, it wasn't right :-). But for typical setups - a few > files or a few dozen files - I don't think it's going to make much > difference. OTOH, if one has thousands of agenda files, then one > probably has much worse problems than this. > > > > Uhhh, yes, indeed! > > - Carsten > > Nick > --f46d042f91a8e8d10c04c60a57ac Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Dear all,=A0

Thanks for your kind reply! Sorry that I di= dn't have chance to check till now.=A0

OKay, I= added the function:

(defun sx-org-revert-age= nda-buffers ()
=A0 (interactive)
=A0 (mapcar
=A0 =A0(lambda (file= )
=A0 =A0 =A0(let ((revert-without-query '(".*\.org$&quo= t;)))
=A0 =A0 =A0 =A0(find-file file)
=A0 =A0 =A0 =A0(r= evert-buffer)))
=A0 =A0(org-agenda-files t)))

It works ! Thanks a = lot!

Xin



On Thu, Jul 26, 2012 at 11:32 PM, Carsten Dominik = <carsten.dominik@gmail.com> wrote:
Carsten Dominik <carsten.dominik@gmail.com> wr= ote:

>
> On 25 jul 2012, at 17:39, Nick Dokos wrote:
>
>> ...
>> 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
>> =A0(lambda (file)
>> =A0 =A0(let ((revert-without-query '(".*\.org$"))) >> =A0 =A0 =A0(find-file file)
>> =A0 =A0 =A0(revert-buffer)))
>> =A0org-agenda-files))
>> --8<---------------cut here---------------end--------------->= ;8---
>
>
> The variable org-agenda-files can also contain directories. =A0Therefo= re
> you should use the function call
>
> =A0 (org-agenda-files t)
>
> to get a list of the files. =A0The t means, even if the agenda
> is currently restricted, get all files.
>

Thanks - I forgot all about that.

> 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.
>

Yes, I thought about that and decided it wasn't= worth worrying about.
As Kernighan and Plauger say: first get it right, then make it fast; and as we just saw, it wasn't right :-). But for typical setups - a few
files or a few dozen files - I don't think it's going to make much<= br> difference. OTOH, if one has thousands of agenda files, then one
probably has much worse problems than this.



Uhhh, yes, indeed!

- Carsten

Nick

--f46d042f91a8e8d10c04c60a57ac--