crontab from Emacs not only with Emacs

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

crontab from Emacs not only with Emacs

Emanuel Berg-5
I found the crontab-mode [1] in MELPA...

I know 'crontab -e' looks for the EDITOR env to
get you your favorite editor...

But how on Earth do I edit my (user's) crontab
file _from the Emacs that I already have open_,
24/7/365+ ?


[1] https://github.com/emacs-pe/crontab-mode

--
underground experts united
http://user.it.uu.se/~embe8573


Reply | Threaded
Open this post in threaded view
|

Re: crontab from Emacs not only with Emacs

Tomas Zerolo
On Sun, May 12, 2019 at 09:57:46AM +0200, Emanuel Berg wrote:
> I found the crontab-mode [1] in MELPA...
>
> I know 'crontab -e' looks for the EDITOR env to
> get you your favorite editor...
>
> But how on Earth do I edit my (user's) crontab
> file _from the Emacs that I already have open_,
> 24/7/365+ ?

emacsclient?

Cheers
-- t

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: crontab from Emacs not only with Emacs

Marcin Borkowski-3
In reply to this post by Emanuel Berg-5

On 2019-05-12, at 09:57, Emanuel Berg <[hidden email]> wrote:

> I found the crontab-mode [1] in MELPA...
>
> I know 'crontab -e' looks for the EDITOR env to
> get you your favorite editor...
>
> But how on Earth do I edit my (user's) crontab
> file _from the Emacs that I already have open_,
> 24/7/365+ ?

Tramp?

--
Marcin Borkowski
http://mbork.pl

Reply | Threaded
Open this post in threaded view
|

Re: crontab from Emacs not only with Emacs

Noam Postavsky
On Sun, 12 May 2019 at 07:26, Marcin Borkowski <[hidden email]> wrote:

>
>
> On 2019-05-12, at 09:57, Emanuel Berg <[hidden email]> wrote:
>
> > I found the crontab-mode [1] in MELPA...
> >
> > I know 'crontab -e' looks for the EDITOR env to
> > get you your favorite editor...
> >
> > But how on Earth do I edit my (user's) crontab
> > file _from the Emacs that I already have open_,
> > 24/7/365+ ?
>
> Tramp?

I think the answer here would be to set EDITOR to emacsclient.

Reply | Threaded
Open this post in threaded view
|

Re: crontab from Emacs not only with Emacs

Marcin Borkowski-3

On 2019-05-12, at 13:28, Noam Postavsky <[hidden email]> wrote:

> On Sun, 12 May 2019 at 07:26, Marcin Borkowski <[hidden email]> wrote:
>>
>>
>> On 2019-05-12, at 09:57, Emanuel Berg <[hidden email]> wrote:
>>
>> > I found the crontab-mode [1] in MELPA...
>> >
>> > I know 'crontab -e' looks for the EDITOR env to
>> > get you your favorite editor...
>> >
>> > But how on Earth do I edit my (user's) crontab
>> > file _from the Emacs that I already have open_,
>> > 24/7/365+ ?
>>
>> Tramp?
>
> I think the answer here would be to set EDITOR to emacsclient.

Yes, I think I misunderstood Emanuel's problem.  Somehow I was thinking
about editing root's crontab.

Best,

--
Marcin Borkowski
http://mbork.pl

Reply | Threaded
Open this post in threaded view
|

Re: crontab from Emacs not only with Emacs

Emanuel Berg-5
In reply to this post by Noam Postavsky
Noam Postavsky wrote:

> I think the answer here would be to set
> EDITOR to emacsclient.

Thanks to all of you, you are right of course!

In Emacs, do

    M-x server-start RET

Then in the shell do

    $ EDITOR=emacsclient crontab -e

Then edit the file in Emacs and do `C-x #'
when done.

The MELPA `crontab-mode' does not kick in by
default tho, but one can live with that, or
configure it, I suppose, based on the crontab
filename. As for me, I think I'll uninstall it
as I don't plan to do that much scheduling with
crontab. Not everything has to have its own
mode! Just like with space. Just because we are
in space, not _everything_ has to be called
something with "space": the "space bar", "space
police", etc. Right?

Anyway if anyone is hooked on SX rep here is
the exact same question [1] but with a couple
of comments and an answer and there is no
mention of this method, which IMO works much
better than their by all means creative
attempts :)


[1] https://emacs.stackexchange.com/questions/10077/how-to-edit-crontab-directly-within-emacs-when-i-already-have-emacs-open

--
underground experts united
http://user.it.uu.se/~embe8573