help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs idiom for sudo


From: Tim X
Subject: Re: emacs idiom for sudo
Date: Wed, 23 May 2007 14:18:44 +1000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

Michael Albinus <address@hidden> writes:

> Tim X <address@hidden> writes:
>
>> Amy Templeton <address@hidden> writes:
>>
>>> Tim X <address@hidden> wrote:
>>>> "Rustom Mody" <address@hidden> writes:
>>>> > Is there a more convenient way for doing 'root-things' than
>>>> > -- get out of emacs (maybe suspend)
>>>> > -- start a shell
>>>> > -- sudo editor (usually vi) OR su ... password... editor
>>>
>>>> I use tramp to do this. Essentially, using either a 'su' or 'sudo' tramp 
>>>> method
>>>> to edit a local file. This is described in the tramp manual.
>>>
>>> What about executing some elisp code as root (obviously including a
>>> password prompt, not just executing it without any question)? Or is
>>> it necessary to just start a whole new Emacs? I didn't see anything
>>> about this in the tramp manual, but I might not be looking hard
>>> enough.
>>>
>>
>> Thats going to be considerably harder to do. The tramp method for editing 
>> files
>> works well because all your really doing is wrapping  find-file and save-file
>> inside scp/ssh and hiding all the gory/boring details under elisp. However,
>> executing a command as another user from within emacs is a bit more 
>> difficult,
>> depending on the command you want to run. 
>
> <advertising>
> Tramp 2.1 (NOT part of Emacs 22.1) provides an implementation for
> call-process and start-process, which let's the corresponding processes
> run on the remote host when default-directory points to such. It is
> experimental code, but it does a good job for me also in the sudo case
> (no wonder, I did implement it :-)
>
> It also cooperates with compile.el, grep.el, gdb.el, eshell.el - just to
> mention the major packages I apply myself.
> </advertising>
>

Thats very interesting - I'll look forward to it reaching stable status. I
suspect this will be a very handy feature when building code on a remote system
- allowing you to use tramp rather than having to run a remote emacs to get the
additional integration from modes that support compilation etc. In fact, I wish
I had it today (working from home and missing my normally well integrated
environment). I know that some modes support remote compilation, but I've never
managed to get them to work in a reliable way or without sacrificing some of
the integration of my emacs environment.

Tim


-- 
tcross (at) rapttech dot com dot au


reply via email to

[Prev in Thread] Current Thread [Next in Thread]