* Could someone give me a hint how to write my own function based on tramp?
@ 2010-09-04 9:16 Lei Wang
2010-09-04 10:29 ` Daniel Pittman
0 siblings, 1 reply; 5+ messages in thread
From: Lei Wang @ 2010-09-04 9:16 UTC (permalink / raw)
To: Emacs mailing list
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.
Could anyone give some advices?
--
Regards,
Lei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Could someone give me a hint how to write my own function based on tramp?
2010-09-04 9:16 Could someone give me a hint how to write my own function based on tramp? Lei Wang
@ 2010-09-04 10:29 ` Daniel Pittman
2010-09-04 12:54 ` Lei Wang
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Pittman @ 2010-09-04 10:29 UTC (permalink / raw)
To: help-gnu-emacs
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.
Anyway, it hooks in through the `file-name-handler-alist', and the methods
`tramp{,completion-}-file-name-handler' which then go ahead and act on the
path passed by the user.
> Could anyone give some advices?
If you define your problem better for us you can likely get better advice.
Regards,
Daniel
--
✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707
♽ made with 100 percent post-consumer electrons
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Could someone give me a hint how to write my own function based on tramp?
2010-09-04 10:29 ` Daniel Pittman
@ 2010-09-04 12:54 ` Lei Wang
2010-09-04 18:45 ` Michael Albinus
0 siblings, 1 reply; 5+ messages in thread
From: Lei Wang @ 2010-09-04 12:54 UTC (permalink / raw)
To: Daniel Pittman; +Cc: help-gnu-emacs
On 9/4/10, Daniel Pittman <daniel@rimspace.net> wrote:
> 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.
>
> Anyway, it hooks in through the `file-name-handler-alist', and the methods
> `tramp{,completion-}-file-name-handler' which then go ahead and act on the
> path passed by the user.
>
>> Could anyone give some advices?
>
> If you define your problem better for us you can likely get better advice.
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.
>
> Regards,
> Daniel
> --
> ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155
> 707
> ♽ made with 100 percent post-consumer electrons
>
>
>
--
Regards,
Lei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Could someone give me a hint how to write my own function based on tramp?
2010-09-04 12:54 ` Lei Wang
@ 2010-09-04 18:45 ` Michael Albinus
2010-09-05 1:51 ` Lei Wang
0 siblings, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2010-09-04 18:45 UTC (permalink / raw)
To: Lei Wang; +Cc: Daniel Pittman, help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Could someone give me a hint how to write my own function based on tramp?
2010-09-04 18:45 ` Michael Albinus
@ 2010-09-05 1:51 ` Lei Wang
0 siblings, 0 replies; 5+ messages in thread
From: Lei Wang @ 2010-09-05 1:51 UTC (permalink / raw)
To: Michael Albinus; +Cc: Daniel Pittman, help-gnu-emacs
Thank you very much! Now, i know how to do it.
It's very helpful. Thanks you all!
On 9/5/10, Michael Albinus <michael.albinus@gmx.de> wrote:
> 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.
>
--
Regards,
Lei
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-09-05 1:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-04 9:16 Could someone give me a hint how to write my own function based on tramp? Lei Wang
2010-09-04 10:29 ` Daniel Pittman
2010-09-04 12:54 ` Lei Wang
2010-09-04 18:45 ` Michael Albinus
2010-09-05 1:51 ` Lei Wang
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).