emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Xin Shi <shixin111@gmail.com>
To: nicholas.dokos@hp.com
Cc: "Christer Boräng" <mort@chalmers.se>,
	Orgmode <emacs-orgmode@gnu.org>,
	"Carsten Dominik" <carsten.dominik@gmail.com>
Subject: Re: Org Agenda - revert all agenda files?
Date: Mon, 30 Jul 2012 13:26:43 +0200	[thread overview]
Message-ID: <CAJN7d848iRWrcM8L1e-FBL3=UfnwxvTeW6vsy2FnideNEi8wmQ@mail.gmail.com> (raw)
In-Reply-To: <51FFFFFB-B4DC-47BC-84C8-34A1D5A8F250@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2112 bytes --]

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 <carsten.dominik@gmail.com
> wrote:

> Carsten Dominik <carsten.dominik@gmail.com> 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
>

[-- Attachment #2: Type: text/html, Size: 3141 bytes --]

      reply	other threads:[~2012-07-30 11:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25  8:09 Org Agenda - revert all agenda files? Xin Shi
2012-07-25  8:18 ` Giovanni Ridolfi
2012-07-25  8:28   ` Xin Shi
2012-07-25 10:52 ` Christer Boräng
2012-07-25 15:39   ` Nick Dokos
2012-07-26  7:27     ` Carsten Dominik
2012-07-26 14:07       ` Nick Dokos
2012-07-26 21:32       ` Carsten Dominik
2012-07-30 11:26         ` Xin Shi [this message]

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJN7d848iRWrcM8L1e-FBL3=UfnwxvTeW6vsy2FnideNEi8wmQ@mail.gmail.com' \
    --to=shixin111@gmail.com \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mort@chalmers.se \
    --cc=nicholas.dokos@hp.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).