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

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

Re: Could someone give me a hint how to write my own function based on t


From: Michael Albinus
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Lei Wang <f3d27b@gmail.com> 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.



reply via email to

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