* external process modifying buffers
@ 2012-09-16 20:47 Ken Mankoff
2012-09-16 21:08 ` Charles Philip Chan
0 siblings, 1 reply; 7+ messages in thread
From: Ken Mankoff @ 2012-09-16 20:47 UTC (permalink / raw)
To: emacs-orgmode
Hi,
I'd like to have my Mac iCal events appear in my agenda. I was using
org-mac-iCal for this without problem, but it doesn't parse things as
well as the external python ical2org program
(http://www.doughellmann.com/projects/ical2org/).
Right now I'm running ical2org via cron and re-generating iCal.org
(redirecting stdout with ">"). When I try to regenerate the agenda,
emacs complains:
iCal.org changed on disk; really edit the buffer? (y, n, r or C-h)
So... How to I get around this?
Is there a flag to tell emacs (org org-mode) to not worry about a
buffer changing?
I don't think I can kill the buffer from the cron command because I'm
not using emacs server so I don't know how to communicate with this
specific emacs instance.
Or should I drop cron and use emacs (run-at-time) to run this, killing
the iCal.org buffer before I do so? I've tried this and have the
following setup. It appears to work, but after I get split-screen and
the output of the shell command. How to do this method tidier?
(defun kdm/kill-iCal-buffer ()
(setq list (mapcar (function buffer-name) (buffer-list)))
(mapc
(lambda (x)
(if (string-match "^iCal" x)
(kill-buffer x)))
list))
(defun kdm/iCal ()
(kdm/kill-iCal-buffer) ; remove the buffer
(shell-command "ical2org>iCal.org")
)
(run-at-time "03:30" 3600 '(lambda () (kdm/iCal)))
(kdm/iCal) ; testing
Any other solutions or advice?
Thanks,
-k.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: external process modifying buffers
2012-09-16 20:47 external process modifying buffers Ken Mankoff
@ 2012-09-16 21:08 ` Charles Philip Chan
2012-09-16 21:24 ` Ken Mankoff
0 siblings, 1 reply; 7+ messages in thread
From: Charles Philip Chan @ 2012-09-16 21:08 UTC (permalink / raw)
To: Org-mode
[-- Attachment #1: Type: text/plain, Size: 441 bytes --]
Ken Mankoff <mankoff@gmail.com> writes:
Hi Ken:
> Right now I'm running ical2org via cron and re-generating iCal.org
> (redirecting stdout with ">"). When I try to regenerate the agenda,
> emacs complains:
>
> iCal.org changed on disk; really edit the buffer? (y, n, r or C-h)
Set "global-auto-revert-mode" to "t".
Cheers,
Charles
--
linux: the choice of a GNU generation
(ksh@cis.ufl.edu put this on Tshirts in '93)
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: external process modifying buffers
2012-09-16 21:08 ` Charles Philip Chan
@ 2012-09-16 21:24 ` Ken Mankoff
2012-09-17 3:34 ` Nick Dokos
2012-09-18 12:28 ` Moritz Ulrich
0 siblings, 2 replies; 7+ messages in thread
From: Ken Mankoff @ 2012-09-16 21:24 UTC (permalink / raw)
To: Charles Philip Chan; +Cc: Org-mode
Thanks! That makes it much cleaner. My setup is now reduced to this:
(setq global-auto-revert-mode t)
(run-at-time "2 minutes" 600 '(lambda () (shell-command "ical2org>iCal.org")))
With full paths to the ical2org binary and the iCal.org file.
Thanks,
-k.
On Sun, Sep 16, 2012 at 2:08 PM, Charles Philip Chan <cpchan@bell.net> wrote:
> Ken Mankoff <mankoff@gmail.com> writes:
>
> Hi Ken:
>
>> Right now I'm running ical2org via cron and re-generating iCal.org
>> (redirecting stdout with ">"). When I try to regenerate the agenda,
>> emacs complains:
>>
>> iCal.org changed on disk; really edit the buffer? (y, n, r or C-h)
>
> Set "global-auto-revert-mode" to "t".
>
> Cheers,
> Charles
>
> --
> linux: the choice of a GNU generation
> (ksh@cis.ufl.edu put this on Tshirts in '93)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: external process modifying buffers
2012-09-16 21:24 ` Ken Mankoff
@ 2012-09-17 3:34 ` Nick Dokos
2012-09-18 12:28 ` Moritz Ulrich
1 sibling, 0 replies; 7+ messages in thread
From: Nick Dokos @ 2012-09-17 3:34 UTC (permalink / raw)
To: Ken Mankoff; +Cc: Charles Philip Chan, Org-mode
Ken Mankoff <mankoff@gmail.com> wrote:
> Thanks! That makes it much cleaner. My setup is now reduced to this:
>
> (setq global-auto-revert-mode t)
> (run-at-time "2 minutes" 600 '(lambda () (shell-command "ical2org>iCal.org")))
>
> With full paths to the ical2org binary and the iCal.org file.
>
> Thanks,
>
> -k.
>
Two points:
o the doc says
,----
| Setting this variable directly does not take effect;
| either customize it (see the info node `Easy Customization')
| or call the function `global-auto-revert-mode'.
`----
o I've pointed out some possible gotcha's with setting
global-auto-revert-mode before - see
http://thread.gmane.org/gmane.emacs.orgmode/58053.
Nick
>
> On Sun, Sep 16, 2012 at 2:08 PM, Charles Philip Chan <cpchan@bell.net> wrote:
> > Ken Mankoff <mankoff@gmail.com> writes:
> >
> > Hi Ken:
> >
> >> Right now I'm running ical2org via cron and re-generating iCal.org
> >> (redirecting stdout with ">"). When I try to regenerate the agenda,
> >> emacs complains:
> >>
> >> iCal.org changed on disk; really edit the buffer? (y, n, r or C-h)
> >
> > Set "global-auto-revert-mode" to "t".
> >
> > Cheers,
> > Charles
> >
> > --
> > linux: the choice of a GNU generation
> > (ksh@cis.ufl.edu put this on Tshirts in '93)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: external process modifying buffers
2012-09-16 21:24 ` Ken Mankoff
2012-09-17 3:34 ` Nick Dokos
@ 2012-09-18 12:28 ` Moritz Ulrich
2012-10-13 16:27 ` Ken Mankoff
1 sibling, 1 reply; 7+ messages in thread
From: Moritz Ulrich @ 2012-09-18 12:28 UTC (permalink / raw)
To: Ken Mankoff; +Cc: Charles Philip Chan, Org-mode
[-- Attachment #1: Type: text/plain, Size: 1354 bytes --]
Ken Mankoff writes:
> Thanks! That makes it much cleaner. My setup is now reduced to this:
>
> (setq global-auto-revert-mode t)
> (run-at-time "2 minutes" 600 '(lambda () (shell-command "ical2org>iCal.org")))
>
> With full paths to the ical2org binary and the iCal.org file.
>
> Thanks,
>
> -k.
>
Please note that `global-auto-revert-mode' reverts ALL Emacs buffers
when the underlaying file changes. This isn't just active for the
iCal.org buffer, but for all open buffers.
If you like this behavior, ok, but if you prefer it for the iCal.org
buffer only, enable auto-revert-mode (without global-) via a file-local
variable in it:
http://www.gnu.org/software/emacs/manual/html_node/emacs/File-Variables.html
>
> On Sun, Sep 16, 2012 at 2:08 PM, Charles Philip Chan <cpchan@bell.net> wrote:
>> Ken Mankoff <mankoff@gmail.com> writes:
>>
>> Hi Ken:
>>
>>> Right now I'm running ical2org via cron and re-generating iCal.org
>>> (redirecting stdout with ">"). When I try to regenerate the agenda,
>>> emacs complains:
>>>
>>> iCal.org changed on disk; really edit the buffer? (y, n, r or C-h)
>>
>> Set "global-auto-revert-mode" to "t".
>>
>> Cheers,
>> Charles
>>
>> --
>> linux: the choice of a GNU generation
>> (ksh@cis.ufl.edu put this on Tshirts in '93)
Cheers,
Moritz
--
Moritz Ulrich
[-- Attachment #2: Type: application/pgp-signature, Size: 486 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: external process modifying buffers
2012-09-18 12:28 ` Moritz Ulrich
@ 2012-10-13 16:27 ` Ken Mankoff
2012-10-13 16:57 ` Sean O'Halpin
0 siblings, 1 reply; 7+ messages in thread
From: Ken Mankoff @ 2012-10-13 16:27 UTC (permalink / raw)
To: Moritz Ulrich; +Cc: Org-mode
Hi Moritz,
On Tue, Sep 18, 2012 at 2:28 PM, Moritz Ulrich <moritz@tarn-vedra.de> wrote:
> Please note that `global-auto-revert-mode' reverts ALL Emacs buffers
> when the underlaying file changes. This isn't just active for the
> iCal.org buffer, but for all open buffers.
>
> If you like this behavior, ok, but if you prefer it for the iCal.org
> buffer only, enable auto-revert-mode (without global-) via a file-local
> variable in it:
>
> http://www.gnu.org/software/emacs/manual/html_node/emacs/File-Variables.html
You are right, global revert-mode causes other issues.
Can you suggest how to have it as a local file variable when the
command that generates the file over-writes it? I have modified the
code that produces the iCal.org file so the top line now is:
# -*- coding: utf-8; auto-revert-mode: t; -*-
But emacs does not seem to be obeying the command. I've restarted
emacs, but when I modify that file with an external command, I still
get the "changed on disk" warning. If I ESC-x auto-revert-mode it
toggles to off, implying it was on. If I do that again, toggling to
on, it then works correctly.
Thanks,
-k.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: external process modifying buffers
2012-10-13 16:27 ` Ken Mankoff
@ 2012-10-13 16:57 ` Sean O'Halpin
0 siblings, 0 replies; 7+ messages in thread
From: Sean O'Halpin @ 2012-10-13 16:57 UTC (permalink / raw)
To: Ken Mankoff; +Cc: Org-mode, Moritz Ulrich
On Sat, Oct 13, 2012 at 5:27 PM, Ken Mankoff <mankoff@gmail.com> wrote:
> Can you suggest how to have it as a local file variable when the
> command that generates the file over-writes it? I have modified the
> code that produces the iCal.org file so the top line now is:
>
> # -*- coding: utf-8; auto-revert-mode: t; -*-
>
> But emacs does not seem to be obeying the command.
I've found this works for me:
# -*- coding: utf-8; eval: (auto-revert-mode 1); -*-
Regards,
Sean
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-10-13 16:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-16 20:47 external process modifying buffers Ken Mankoff
2012-09-16 21:08 ` Charles Philip Chan
2012-09-16 21:24 ` Ken Mankoff
2012-09-17 3:34 ` Nick Dokos
2012-09-18 12:28 ` Moritz Ulrich
2012-10-13 16:27 ` Ken Mankoff
2012-10-13 16:57 ` Sean O'Halpin
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).