Re: [O] external process modifying buffers

2012-10-13 Thread Sean O'Halpin
On Sat, Oct 13, 2012 at 5:27 PM, Ken Mankoff  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



Re: [O] external process modifying buffers

2012-10-13 Thread Ken Mankoff
Hi Moritz,

On Tue, Sep 18, 2012 at 2:28 PM, Moritz Ulrich  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.



Re: [O] external process modifying buffers

2012-09-18 Thread Moritz Ulrich

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  wrote:
>> Ken Mankoff  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
>> (k...@cis.ufl.edu put this on Tshirts in '93)

Cheers,
Moritz


-- 
Moritz Ulrich


pgpuuMJ7XyJgz.pgp
Description: PGP signature


Re: [O] external process modifying buffers

2012-09-16 Thread Nick Dokos
Ken Mankoff  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  wrote:
> > Ken Mankoff  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
> > (k...@cis.ufl.edu put this on Tshirts in '93)
> 



Re: [O] external process modifying buffers

2012-09-16 Thread Ken Mankoff
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  wrote:
> Ken Mankoff  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
> (k...@cis.ufl.edu put this on Tshirts in '93)



Re: [O] external process modifying buffers

2012-09-16 Thread Charles Philip Chan
Ken Mankoff  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
(k...@cis.ufl.edu put this on Tshirts in '93)


pgpsd8fnlxaEK.pgp
Description: PGP signature


[O] external process modifying buffers

2012-09-16 Thread Ken Mankoff
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.