News for hackers. Stuff that matters.
Re:Absolute Beginner's Guide to Emacs (2012) by Tistel on Tuesday December 04, 2018 @10:54AM (#18600494)
You should check out tramp-mode too. Its a killer feature that lets you edit files remotely (AWS, Azure, even docker containers!) as if they are local. All the stuff work, so you can do diffs between a local file and an a AWS file and it all appears to be local. If you are editing a remote file and do a git action (through magit) it knows to work on the remote file. You can open up remote shells also. You just go:

CTRL-X CTRL-F then => /ssh:[email protected]:~/somefile.txt

and you get a local buffer with the contents of the remote file (via scp). All your editing is the same as if it is local. When you save it does a scp back to the remote machine. You can even edit in docker containers:

/docker:root@03f5f926f1ca:/etc/environment

as if they are local. Merges/diffs all just work its really great.

Re:Absolute Beginner's Guide to Emacs (2012) by jwdunne on Tuesday December 04, 2018 @11:13AM (#18600708)
You can also spawn a shell, provided your particular shell is available, in another window too. I can stay entirely within Emacs if I realise, say, I need to do something en masse that's really easy with a shell one liner.

Though if I'm exploring a server problem, it's useful to know how to use vim. If Emacs IS installed, it's probably with default settings and it's easy to forget that it'll scatter auto saves everywhere by default. Especially (and usually only) when I'm behind a machine that doesn't have by Emacs set up.

Re:Absolute Beginner's Guide to Emacs (2012) by escapecharacter on Tuesday December 04, 2018 @11:11AM (#18600680)
I use /gcssh: with tramp to access files on my Google Cloud machines. It's great. Snippet here:

https://github.com/dustinfreeman/dustinfreeman.emacs.d/blob/...

Format is C-x C-f /gcssh:compute-instance-name:/path/on/remote/machine/filename.txt

Re:Absolute Beginner's Guide to Emacs (2012) by Vekz on Tuesday December 04, 2018 @10:59AM (#18600561)
A common selling point for VIM is "its installed everywhere you just ssh in and it's available".

To that, I usually bring up tramp and say, who cares you just ssh in from emacs.

Re:Absolute Beginner's Guide to Emacs (2012) by admax88q on Tuesday December 04, 2018 @11:20AM (#18600783)
> A common selling point for VIM is "its installed everywhere you just ssh in and it's available".

I've never understood this argument unless you're coming at it from a sysadmin perspective. Sure if its available everywhere that helps when I'm sshing in to random systems to sysadmin stuff.

But I don't do my development by logging in to random new systems all the time. I do my development in an environment that I have set up to be productive with.

Re:Absolute Beginner's Guide to Emacs (2012) by anyfoo on Tuesday December 04, 2018 @11:34AM (#18600932)
That’s a very specific development story, though, common to e.g. web development.

If you’re, for example, a developer working on an embedded platform which (even temporarily) has no ssh, and probably no emacs as well, tramp-mode won’t work.

I’m a hard emacser, but it’s true that vi is usually much more ubiquitously available, so it’s good to know how to use it.

Re:Absolute Beginner's Guide to Emacs (2012) by TeMPOraL on Tuesday December 04, 2018 @05:06PM (#18604018)
SSH isn't the only protocol supported by Tramp (from what I hear, it's actually a late addition). Essentially, if you can get somehow get a shell on a remote machine, you can make Tramp work with it.
Re:Absolute Beginner's Guide to Emacs (2012) by anyfoo on Tuesday December 04, 2018 @08:56PM (#18605173)
It might be possible to get tramp working over a serial line (while still being able to use the same shell, though?), or over telnet, but practically I'd probably just type "vi" to quickly edit a file.

Again, I'm saying that as someone who uses tramp-mode all the time, otherwise.

Re:Absolute Beginner's Guide to Emacs (2012) by admax88q on Tuesday December 04, 2018 @08:08PM (#18604952)
> If you’re, for example, a developer working on an embedded platform which (even temporarily) has no ssh, and probably no emacs as well, tramp-mode won’t work.

Maybe I'm wrong but I really don't think embedded developers do a lot of work directly on platforms that low level/limited.

You do your development on your main machine, automate deployment to your target, and debug using a gdb server or openocd.

Honestly mg or nano is more ubiquitous than vi. Any system that has vi installed will likely have nano as well.

Re:Absolute Beginner's Guide to Emacs (2012) by anyfoo on Tuesday December 04, 2018 @08:53PM (#18605162)
As an OS developer myself, I can tell you that logging into platforms to quickly tweak something using vi happens all the time. It's not about "directly developing" on the platforms, it's about debugging and trying things out.

nano is a very young editor, comparably, invented in 1999, and GPL on top of that. I'm not sure it even come out of the box with any of the BSDs (OpenBSD at least does not seem to have it).

vi was first written by Bill Joy himself in 1976, and I'm pretty sure it proliferated in many different forms over many, many different platforms.

mg, I don't know!

Re:Absolute Beginner's Guide to Emacs (2012) by TeMPOraL on Tuesday December 04, 2018 @05:05PM (#18604005)
This really hits at a core of what I call developer vs. sysadmin perspective. A developer usually works in a persistent environment they fully control. A sysadmin does a lot of work on multiple, often short-lived servers. So the former prefers customizing things the way they like; the latter learns and sticks to defaults.

At one of the Lisp projects I worked on, this split was clearly visible. One of my co-workers had the dev perspective, the other had the sysadmin view. Both used Emacs and Slime, but one had it fully customized, and other had it bare-bones, and spent most of his time in raw terminal anyway.

(I, of course, am hard down on developer view. My Emacs config has no peers :)).

Re:Absolute Beginner's Guide to Emacs (2012) by IronBacon on Tuesday December 04, 2018 @02:01PM (#18602565)
Forget Org mode, forget Tramp, the killer feature is renaming multiple files with Dired! ^__~
Re:Absolute Beginner's Guide to Emacs (2012) by TeMPOraL on Tuesday December 04, 2018 @05:08PM (#18604039)
Totally. C-x C-q on a dired buffer, and you can edit most of what's essentially an ls output as if it was a text file. C-c C-c to commit changes. I find myself using it very frequently for file management.
Re:Absolute Beginner's Guide to Emacs (2012) by TeMPOraL on Tuesday December 04, 2018 @05:00PM (#18603973)
Seconding the recommendation.

On my last project, I decided to do all remote server ops through Tramp, just to see how convenient it was. Turns out, very.

Besides launching a shell, one trick that you can do is piping Tramp invocation, including across different protocols - essentially creating tunnels. One special case I use frequently is for sudo operations.

C-x C-f, then /ssh:[email protected]|sudo:example.com:/etc/someconfig

Suddenly, you're editing as if you launched a session with sudo on the end machine.

Coupled with dired and M-x shell, it becomes a very convenient way of working.

(And in case Tramp causes you trouble, or you just need to close remote buffers and connections, remember about M-x tramp-cleanup-* set of commands.)

EDIT:

And lest I forget - GDB integration works over Tramp too.

Re:Absolute Beginner's Guide to Emacs (2012) by julienchastang on Tuesday December 04, 2018 @12:39PM (#18601633)
I also recommend helm-tramp for added tramp greatness for example if you regularly access many different hosts/VMs.

Question: I often find tramp to be significantly laggy and much slower when compared to simply sshing into the remote host. It is almost as if tramp is opening up a new ssh connection for every command. What do people here do about tramp lagginess? I've researched this problem but I have not found a good solution.

Re:Absolute Beginner's Guide to Emacs (2012) by loskutak on Tuesday December 04, 2018 @03:04PM (#18603145)
you can use ssh controlmaster (adding variation of the following into your .ssh/config):

Host *

ControlMaster auto

ControlPath /tmp/ssh-%r@%h:%p

This helped me quite a lot with tramp

Re:Absolute Beginner's Guide to Emacs (2012) by anonacct37 on Tuesday December 04, 2018 @02:45PM (#18602992)
The enable ssh mastercontrol and persistent connections.
Re:Absolute Beginner's Guide to Emacs (2012) by julienchastang on Tuesday December 04, 2018 @03:05PM (#18603149)
@anonacct37 I've always had

ControlMaster auto

ControlPath ~/.ssh/cm_socket/%r@%h:%p

ServerAliveInterval 60

Is there something beyond that I should be doing? Does tramp need to be configured in some special way to take advantage of the persistent connection?

Re:Absolute Beginner's Guide to Emacs (2012) by rcfox on Tuesday December 04, 2018 @03:56PM (#18603531)
I had no idea tramp-mode supported docker, that's amazing.

FYI: You can set it up to use the container names:

M-x customize-variable docker-tramp-use-names

Re:Absolute Beginner's Guide to Emacs (2012) by lelf on Tuesday December 04, 2018 @11:28AM (#18600874)
M-x compile (and related) works too.
Re:Absolute Beginner's Guide to Emacs (2012) by iambvk on Tuesday December 04, 2018 @01:44PM (#18602354)
I use this all the time.

- edit over tramp - dired over tramp - magit over tramp - build over tramp

Just Beautiful.

Re:Absolute Beginner's Guide to Emacs (2012) by TeMPOraL on Tuesday December 04, 2018 @05:11PM (#18604051)
And GDB integration.
Re:Absolute Beginner's Guide to Emacs (2012) by znpy on Tuesday December 04, 2018 @12:56PM (#18601828)
I used it on Windows to edit files on a RHEL machine.

It worked okay, only issue i had is that periodic autosave makes the whole emacs freeze due to network round-trip. Disabling/toggling autosave or lenthening the autosave timeout solved solves the issue.

BTW, tramp is really awesome. One of those pearls within GNU Emacs.

Re:Absolute Beginner's Guide to Emacs (2012) by mkettn on Tuesday December 04, 2018 @11:59AM (#18601207)
tramp supports a great amount of protocols, but only ssh is on active support. I worked in a greater company for a while and used it to access remote files shared via windows file sharing (smb). It worked a long time but then server update came, next smbclient update came and at last tramp update came... hindering me in my workflow for a couple of month.
Re:Absolute Beginner's Guide to Emacs (2012) by kqr on Tuesday December 04, 2018 @06:15PM (#18604385)
Oh, and do try a dual-pane file manager (like Sunrise Commander) with Tramp. Now the entire world becomes your local file system.
Re:Absolute Beginner's Guide to Emacs (2012) by black-tea on Tuesday December 04, 2018 @05:36PM (#18604182)
Tramp is even more convenient if you set up an ssh config (which you should do anyway). Then you can just open ssh:myserver:somefile

Tramp actually does something more clever than an scp too, so it even works on servers that don't support scp.