From: Carsten Dominik <carsten.dominik@gmail.com>
To: nicholas.dokos@hp.com
Cc: Orgmode <emacs-orgmode@gnu.org>, "Xin Shi" <shixin111@gmail.com>,
Christer =?utf-8?Q?Bor=C3=A4ng?= <mort@chalmers.se>
Subject: Re: Org Agenda - revert all agenda files?
Date: Thu, 26 Jul 2012 09:27:05 +0200 [thread overview]
Message-ID: <231F203A-2C16-4EF8-98E5-9ED5513D7AB0@gmail.com> (raw)
In-Reply-To: <3886.1343230740@alphaville>
On 25 jul 2012, at 17:39, Nick Dokos wrote:
> Christer Boräng <mort@chalmers.se> wrote:
>
>> In message <CAJN7d86LrDuFQibeTCh3g-WvgTk75ituqXccVf=Y1qDvWPPjRA@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---
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
>
> Nick
>
- Carsten
next prev parent reply other threads:[~2012-07-26 7: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 [this message]
2012-07-26 14:07 ` Nick Dokos
2012-07-26 21:32 ` Carsten Dominik
2012-07-30 11:26 ` Xin Shi
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=231F203A-2C16-4EF8-98E5-9ED5513D7AB0@gmail.com \
--to=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=mort@chalmers.se \
--cc=nicholas.dokos@hp.com \
--cc=shixin111@gmail.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).