Web lists-archives.com

Re: text editors

On Thu, Mar 28, 2019 at 08:32:40AM +0000, Gian Uberto Lauri wrote:
> >>>>> "TL" == Teemu Likonen <tlikonen@xxxxxx> writes:
> TL>     $ emacs /ssh:user@middle-machine\|ssh:user@target-machine:file
> This is wickedly interesting!

If you find that interesting...

imagine you're running your emacs (as a server) and want to
edit that one system file (say /etc/apt/sources.list) as sudo
(without starting an Emacs instance as root).

  M-x find-file <RET> /sudo::/etc/apt/sources.list

(key binding for find-file is C-x C-f, or just use a GUI menu).

will do the trick. It asks you for the necessary password and
will cache it for a configurable time. Should it time out, it'll
ask you again.

The above /ssh:... pattern will have another advantage: if,
while you edit the file, the ssh connection times out or breaks
down, it'll reconnect if necessary (asking you for your password
or ssh key passphrase, as the case may be -- unless your ssh
agent is already taking care of that).

Now imagine you have an ssh access as myuser to myvirtualserver.com.

To edit *there*, as sudo, simply do:

  C-x C-f ssh:myuser@xxxxxxxxxxxxxxxxxxx|sudo:myvirtualserver.com:/etc/apt/sources.list

This is all courtesy of Tramp, the library for access files
in "non-standard places".

Now enter Org-Mode. This is a kind of markup language (somewhat
reminiscent of Markdown). There you can have links to other
files (or positions therein). Those links can be Tramp paths
as illustrated above.

Bam :-)

So there are many nifty things in Emacs. But the real killer
is the integration of all those nifty things.

-- tomás

Attachment: signature.asc
Description: Digital signature