From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: emacs idiom for sudo Date: Wed, 23 May 2007 14:18:44 +1000 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <87k5v0cguz.fsf@lion.rapttech.com.au> References: <87k5v4doio.fsf@lion.rapttech.com.au> <87abvxdzwk.fsf@lion.rapttech.com.au> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1179895317 32292 80.91.229.12 (23 May 2007 04:41:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 23 May 2007 04:41:57 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 23 06:41:54 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HqifZ-0001IV-Qv for geh-help-gnu-emacs@m.gmane.org; Wed, 23 May 2007 06:41:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hqifa-0002CH-EX for geh-help-gnu-emacs@m.gmane.org; Wed, 23 May 2007 00:41:54 -0400 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!sn-xt-sjc-03!sn-xt-sjc-06!sn-xt-sjc-01!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) Cancel-Lock: sha1:8UfP+R244UP7/aZUddXs/vYFrO0= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 55 Original-Xref: shelby.stanford.edu gnu.emacs.help:148717 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:44306 Archived-At: Michael Albinus writes: > Tim X writes: > >> Amy Templeton writes: >> >>> Tim X wrote: >>>> "Rustom Mody" 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. > > > 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. > > 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