emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org Agenda - revert all agenda files?
@ 2012-07-25  8:09 Xin Shi
  2012-07-25  8:18 ` Giovanni Ridolfi
  2012-07-25 10:52 ` Christer Boräng
  0 siblings, 2 replies; 9+ messages in thread
From: Xin Shi @ 2012-07-25  8:09 UTC (permalink / raw)
  To: emacs-orgmode

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

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"?

Thanks!

Xin

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Org Agenda - revert all agenda files?
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Giovanni Ridolfi @ 2012-07-25  8:18 UTC (permalink / raw)
  To: Xin Shi; +Cc: Orgmode

Hi, Xin,

Da: Xin Shi <shixin111@gmail.com>
Inviato: Mercoledì 25 Luglio 2012 10:09


> 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"? 

why don't you use "g" ? (ah I've just read it is the same)

however I am not asked what to do both with r and g). Org rebuilts the agenda reading from disk.
Do you have some configuration for asking?

Org-mode version 7.8.11 (eed478ffa @ 
GNU Emacs 24.1.1 (i386-mingw-nt6.1.7601) of 2012-06-10 on MARVIN


cheers,
Giovanni


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Org Agenda - revert all agenda files?
  2012-07-25  8:18 ` Giovanni Ridolfi
@ 2012-07-25  8:28   ` Xin Shi
  0 siblings, 0 replies; 9+ messages in thread
From: Xin Shi @ 2012-07-25  8:28 UTC (permalink / raw)
  To: Giovanni Ridolfi; +Cc: Orgmode

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

Hi Giovanni,

Thanks for your quick response. You're right that g and r are the same
thing. To reproduce what my problem, one has to change the file not inside
the Emacs of org-mode, such as in a terminal (the senario is that the files
are updated remotely and controlled by VC) . For example, a.org is one of
the agenda files, one can do in terminal:

$ echo "Additional line to test" >> a.org

Then, inside the *Org Agenda* buffer, press "g" or "r" will show:

a.org changed on disk; really edit the buffer? (y, n, r or C-h)

Xin





On Wed, Jul 25, 2012 at 10:18 AM, Giovanni Ridolfi <
giovanni.ridolfi@yahoo.it> wrote:

> Hi, Xin,
>
> Da: Xin Shi <shixin111@gmail.com>
> Inviato: Mercoledì 25 Luglio 2012 10:09
>
>
> > 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"?
>
> why don't you use "g" ? (ah I've just read it is the same)
>
> however I am not asked what to do both with r and g). Org rebuilts the
> agenda reading from disk.
> Do you have some configuration for asking?
>
> Org-mode version 7.8.11 (eed478ffa @
> GNU Emacs 24.1.1 (i386-mingw-nt6.1.7601) of 2012-06-10 on MARVIN
>
>
> cheers,
> Giovanni
>
>

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Org Agenda - revert all agenda files?
  2012-07-25  8:09 Org Agenda - revert all agenda files? Xin Shi
  2012-07-25  8:18 ` Giovanni Ridolfi
@ 2012-07-25 10:52 ` Christer Boräng
  2012-07-25 15:39   ` Nick Dokos
  1 sibling, 1 reply; 9+ messages in thread
From: Christer Boräng @ 2012-07-25 10:52 UTC (permalink / raw)
  To: Xin Shi; +Cc: Orgmode

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.

//Christer

-- 
| Hagåkersgatan 18C | Phone: Home +46 31 43 52 03   CTH: +46 31 772 5431  |
| S-431 41 Mölndal  |        Cell: +46 707 53 57 57                       |
| Sweden            | Mail:  mort@chalmers.se                             |
"An NT server can be run by an idiot, and usually is." -- Tom Holub, a.h.b-o-i

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Org Agenda - revert all agenda files?
  2012-07-25 10:52 ` Christer Boräng
@ 2012-07-25 15:39   ` Nick Dokos
  2012-07-26  7:27     ` Carsten Dominik
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Dokos @ 2012-07-25 15:39 UTC (permalink / raw)
  To: Christer =?utf-8?Q?Bor=C3=A4ng?=; +Cc: Orgmode, Xin Shi

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

Nick

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Org Agenda - revert all agenda files?
  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
  0 siblings, 2 replies; 9+ messages in thread
From: Carsten Dominik @ 2012-07-26  7:27 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Orgmode, Xin Shi, Christer =?utf-8?Q?Bor=C3=A4ng?=


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Org Agenda - revert all agenda files?
  2012-07-26  7:27     ` Carsten Dominik
@ 2012-07-26 14:07       ` Nick Dokos
  2012-07-26 21:32       ` Carsten Dominik
  1 sibling, 0 replies; 9+ messages in thread
From: Nick Dokos @ 2012-07-26 14:07 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Orgmode, Xin Shi, Christer =?utf-8?Q?Bor=C3=A4ng?=

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.

Nick

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Org Agenda - revert all agenda files?
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Carsten Dominik @ 2012-07-26 21:32 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Orgmode, Xin Shi, Christer =?utf-8?Q?Bor=C3=A4ng?=

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Org Agenda - revert all agenda files?
  2012-07-26 21:32       ` Carsten Dominik
@ 2012-07-30 11:26         ` Xin Shi
  0 siblings, 0 replies; 9+ messages in thread
From: Xin Shi @ 2012-07-30 11:26 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Christer Boräng, Orgmode, Carsten Dominik

[-- 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 --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-07-30 11:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

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