From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.help Subject: Re: Could someone give me a hint how to write my own function based on tramp? Date: Sat, 04 Sep 2010 20:45:40 +0200 Message-ID: <87k4n1z6sr.fsf@gmx.de> References: <87fwxp7qe9.fsf@rimspace.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1283625986 13504 80.91.229.12 (4 Sep 2010 18:46:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 4 Sep 2010 18:46:26 +0000 (UTC) Cc: Daniel Pittman , help-gnu-emacs@gnu.org To: Lei Wang Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Sep 04 20:46:21 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 1Orxkn-0002P1-AW for geh-help-gnu-emacs@m.gmane.org; Sat, 04 Sep 2010 20:46:17 +0200 Original-Received: from localhost ([127.0.0.1]:52632 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Orxkm-0000I1-O4 for geh-help-gnu-emacs@m.gmane.org; Sat, 04 Sep 2010 14:46:16 -0400 Original-Received: from [140.186.70.92] (port=59668 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OrxkO-0000Hw-2Q for help-gnu-emacs@gnu.org; Sat, 04 Sep 2010 14:45:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OrxkN-0000sv-0t for help-gnu-emacs@gnu.org; Sat, 04 Sep 2010 14:45:51 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.22]:39153 helo=mail.gmx.net) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OrxkM-0000sW-K9 for help-gnu-emacs@gnu.org; Sat, 04 Sep 2010 14:45:50 -0400 Original-Received: (qmail invoked by alias); 04 Sep 2010 18:45:47 -0000 Original-Received: from p4FC184C0.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [79.193.132.192] by mail.gmx.net (mp072) with SMTP; 04 Sep 2010 20:45:47 +0200 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/ayXMwtoXaVb4W3iHhn94x1C+64G0huBmQdIPhRS osV6Q8vRP6BVFl In-Reply-To: (Lei Wang's message of "Sat, 4 Sep 2010 20:54:03 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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:74882 Archived-At: 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.