From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lei Wang Newsgroups: gmane.emacs.help Subject: Re: Could someone give me a hint how to write my own function based on tramp? Date: Sun, 5 Sep 2010 09:51:48 +0800 Message-ID: References: <87fwxp7qe9.fsf@rimspace.net> <87k4n1z6sr.fsf@gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1283652078 1158 80.91.229.12 (5 Sep 2010 02:01:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 5 Sep 2010 02:01:18 +0000 (UTC) Cc: Daniel Pittman , help-gnu-emacs@gnu.org To: Michael Albinus Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Sep 05 04:01:17 2010 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.69) (envelope-from ) id 1Os4Xk-0006gz-KO for geh-help-gnu-emacs@m.gmane.org; Sun, 05 Sep 2010 04:01:16 +0200 Original-Received: from localhost ([127.0.0.1]:42288 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Os4Xk-0003pO-41 for geh-help-gnu-emacs@m.gmane.org; Sat, 04 Sep 2010 22:01:16 -0400 Original-Received: from [140.186.70.92] (port=59374 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Os4Wf-0003Ze-Sc for help-gnu-emacs@gnu.org; Sat, 04 Sep 2010 22:00:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Os4Ob-0003mW-Tb for help-gnu-emacs@gnu.org; Sat, 04 Sep 2010 21:51:51 -0400 Original-Received: from mail-fx0-f41.google.com ([209.85.161.41]:50797) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Os4Ob-0003mJ-MG for help-gnu-emacs@gnu.org; Sat, 04 Sep 2010 21:51:49 -0400 Original-Received: by fxm3 with SMTP id 3so2310211fxm.0 for ; Sat, 04 Sep 2010 18:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=Rr46FTmA2sUV30KsGgB2KcALoiAtz7TaARPZ2tMgs4o=; b=eAS7UL9ztog9GPcUBgHthXceeExOXr2ErADwbuC26345xILVA7mJ9M9cL11EF+K6Q3 KpIwYPcveTYxckNGXW4J4PAkqO5MPOtEVNz0yff8HP9nujCLpbyRyvRHG2rfZq7YeyBD brfVFlVkQl6lTdkbCo7g6PJgGFgF+GkTQNByI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=rj25nfAPJZ4vxKHDJ+Uk54kD3ACSa+1RfqPlv2AU40LJFQyzGnyTko+XXRCDypPOpt Th+AhRJQ1Hb2Nv+LTEH5A/bj6A6ac0tJGfJZ/lAb9ht4+0b86d6GSb7dX5NOT2AzshjM mcz97prd/Jnemktomqe9IOS6lslPogHGSu9Cc= Original-Received: by 10.239.193.134 with SMTP id j6mr182518hbi.65.1283651508444; Sat, 04 Sep 2010 18:51:48 -0700 (PDT) Original-Received: by 10.239.160.135 with HTTP; Sat, 4 Sep 2010 18:51:48 -0700 (PDT) In-Reply-To: <87k4n1z6sr.fsf@gmx.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:74887 Archived-At: Thank you very much! Now, i know how to do it. It's very helpful. Thanks you all! On 9/5/10, Michael Albinus wrote: > Lei Wang writes: > >>>> I want to write a function for my own use. It is going to be a wraper of >>>> an >>>> operation sequence, such as, change to root, run some shell and create >>>> and >>>> open a file. But i even can't find to use which tramp function, and how >>>> does >>>> tramp start. >>> >>> Yeah. You probably won't find TRAMP much help in writing that, frankly, >>> because it does a lot of things that are entirely irrelevant but quite >>> complex >>> compared to what you want. >> >> Thanks for this information. > > Likely, you don't need to think about Tramp at all. When you operate > with a default-directory pointing to your remote host, Emacs' functions > like `shell', `process-file' and `start-file-process' work on the remote > host. Whether it is Tramp or not, is not relevant. > > (Tramp works in the background for you. It requires Tramp 2.1, also part > of Emacs 23) > >> Ok. Nowadays, when i want to access a crypto partition, i do the >> following steps, open a shell, su to root, /sbin/cryptsetup luksOpen, >> mount, create a file, edit, save, umount, /sbin/cryptsetup luksClose. >> It's very annoying. So i want to make a wrapper function. Of course, >> the 2 times password inputs couldn't be bypassed. > > (let ((default-directory "/su::/")) > ... do your actions ... > ) > >> Regards, >> Lei > > Best regards, Michael. > -- Regards, Lei