unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tim X <timx@nospam.dev.null>
To: help-gnu-emacs@gnu.org
Subject: Re: emacs idiom for sudo
Date: Wed, 23 May 2007 14:18:44 +1000	[thread overview]
Message-ID: <87k5v0cguz.fsf@lion.rapttech.com.au> (raw)
In-Reply-To: mailman.1025.1179866756.32220.help-gnu-emacs@gnu.org

Michael Albinus <michael.albinus@gmx.de> writes:

> Tim X <timx@nospam.dev.null> writes:
>
>> Amy Templeton <amy.g.templeton@gmail.com> writes:
>>
>>> Tim X <timx@nospam.dev.null> wrote:
>>>> "Rustom Mody" <rustompmody@gmail.com> 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

  parent reply	other threads:[~2007-05-23  4:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.880.1179633671.32220.help-gnu-emacs@gnu.org>
2007-05-20  5:58 ` emacs idiom for sudo Tim X
2007-05-22  4:18   ` Amy Templeton
     [not found]   ` <mailman.947.1179807172.32220.help-gnu-emacs@gnu.org>
2007-05-22  8:29     ` Tim X
2007-05-22 14:25       ` foo@bar.baz
2007-05-22 17:11         ` Peter Dyballa
2007-05-22 21:45         ` Xavier Maillard
2007-05-23  4:13         ` Tim X
2007-05-22 20:45       ` Michael Albinus
     [not found]       ` <mailman.1025.1179866756.32220.help-gnu-emacs@gnu.org>
2007-05-23  4:18         ` Tim X [this message]
2007-05-22 22:53     ` David Kastrup
2007-05-23 10:33       ` reader
2007-05-23 12:02         ` Peter Dyballa
2007-05-20  4:01 Rustom Mody
2007-05-20  5:19 ` Eric Hanchrow
2007-05-21 12:07   ` Rustom Mody
2007-05-22  2:38   ` Matthew Flaschen
2007-05-22  4:38 ` Xavier Maillard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k5v0cguz.fsf@lion.rapttech.com.au \
    --to=timx@nospam.dev.null \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).