reddit / emacs

Emacs for Professionals: "Emacs as a Shell" (not about shell-mode) about how Emacs is a shell in and of iteself

ramin-honary-xc · 2022-05-05 14:47
ramin-honary-xc · 2022-05-05 14:49
This article had already been published when I [posted my introduction to the "Emacs for Professionals" series](https://www.reddit.com/r/emacs/comments/ugid5m/ive_started_writing_a_series_of_articles_called/ ), but I wanted to post each article separately on Reddit as a place to collect comments and criticism on this specific article. Thanks for reading!
raevnos · 2022-05-05 16:00
chsh -s /usr/bin/emacs
Michaelmrose · 2022-05-05 18:02
pkal on the #emacs channel on the Libera irc network says read your emails. Edit: correct username
vifon · 2022-05-05 19:57
[Looks vaguely familiar](https://blog.einval.eu/2020/04/emacs-as-a-shell/) (pardon a shameless plug). :D Great read, thanks!
jplindstrom · 2022-05-05 22:14
You should mention `shell-command-on-region` or `M-|`, especially `C-u M-|` to replace the current region with the command output. Very useful.
[deleted] · 2022-05-05 22:49
[deleted]
ramin-honary-xc · 2022-05-06 00:58
Thank you for linking me to your article! I will be sure to refer to it in my article in a "further reading" section.
ramin-honary-xc · 2022-05-06 01:05
> You should mention `shell-command-on-region` or `M-|`, especially `C-u M-|` > You're right. I think I was going to add that one but it slipped my mind. I use that command only a few hundred times a day.
ramin-honary-xc · 2022-05-06 01:06
Thanks for the notification.
molteanu · 2022-05-06 05:43
What is your most loved and lesser known Emacs command/feature? I like the region undo, for example. That is, select a region and then any undo command will undo only in that region. Awesomely useful. Great content and presentation. I'm browsing the other articles already.
ramin-honary-xc · 2022-05-06 06:53
> What is your most loved and lesser known Emacs command/feature? That is an interesting question. I can think of three for now: - WDired (press `C-x C-q` in a `dired` buffer), you can change the names of files and commit them to the filesystem with `C-c C-c`. I actually use this anytime I need to rename a file, more so than a graphical file manager or the `mv` command. - In `shell-mode` I like to use `compilation-shell-minor-mode`, it uses regular expressions to find references to files and line numbers and automatically hyperlinks them, and makes it so you can navigate the links with `M-g n` and `M-g p`. This is a kind of minimalist IDE for absolutely any programming language, it really helps me to play around with learning new programming languages and other such software without having to install a whole bunch of tooling. - Storing a window/buffer layout in a register, with `C-x r w <Register>`, and restore it with `C-x r j <Register>`. This feature may be superseded by tabs, or by the `perspective.el` package. I like to save my window and buffer layout sometimes before going down a rabbit hole trying to search for some piece of information, then going back to where I was working with `C-x r j <Register>`. I'll make a note to talk about region-undo at some time in the future. > Great content and presentation. Thanks for the encouraging words!
vifon · 2022-05-06 08:31
Good idea, thanks, I just did the same.
meedstrom · 2022-05-06 09:22
Install objed for `objed-ipipe`. Bind that to `M-|`, it's even better. Auto-previews the result as you bash out your long complicated Bash command. I prefer to use Emacs instead of Unix, e.g. M-x flush-lines, and piper when all else fails, but I'll write a post on that eventually.
rswgnu · 2022-05-08 16:41
With regard to your second point, with the GNU Hyperbole package, you can forego compilation-shell-minor-mode and just jump to any error across lanaguages with {M-RET}. This also works on multi-level file listing outputs from ‘ls’ and for displaying paths from the colon or semicolon separated env variables values like ‘echo $PATH’.
molteanu · 2022-05-09 05:14
How do I activate/use Hyperbole for the output of ls (in eshell), for example? Currently, I see no difference with or without the hyperbole-mode regarding ls output and RET behavior.
rswgnu · 2022-05-09 05:40
It's M-RET. That should display the pathname at point. We may not have coded for eshell yet, however. If not, it would be a one line change to add it. We’ll have a look.
molteanu · 2022-05-09 18:42
Works straight out of the box! Awesome! Thanks for the info!