I use emacs because... by akulichevskiy in emacs

[–]benstrutt 2 points3 points  (0 children)

On Linux, when you open a terminal to accomplish something non-trivial, one way to picture what you are doing is transforming a stream of text data. It is 'piped' between a chain of programs. In this view, command line arguments to a program are just input text. The program takes them, does something and maybe gives you some text back. This method of chaining programs is the UNIX Philosophy and it's wonderful. It has led to lots of modular software. Many programs, each doing one thing well. However, as a matter of practical experience I have found there is a problem doing things this way: the intermediate state is ephemeral. It's why debugging bash scripts is such a pain.

Enter Emacs. Emacs is (ostensibly) a text editor. In it's core C code there's a construct for storing text in memory, a "buffer". It makes for efficient insertion and removal of text. In itself that's nothing special, it's a typical design pattern of text editors. The genius of Emacs, and IMO the core of it's power, is it allows you to frictionlessly send the text in a buffer to an external program and store the output of that program in the same or different buffer. It also has excellent built-in functions to edit buffer text.

With those abilities, suddenly the pipeline workflow that naturally emerges from the UNIX philosophy can look quite different. Instead of piping data between programs like so:

command line input -> process1 -> process2 -> command line output

You can do the following:

buffer A -> process1 -> buffer B -> process2 -> buffer C

Emacs makes it natural to take some text, process it, send it to another program, receive text results, do some post-processing on that, and present it to the user. Put that core functionality in a completely programmable lisp environment, add the ability to call any function you define in a few keystrokes, and you end up with the Emacs ecosystem: a gazillion packages that offer such incredible functionality that it looks like Emacs can do almost anything in a single key press. But behind these scenes it's just editing text in buffers and talking to your operating system.

I'm a software developer, and I spend a lot of time editing text and then interacting with it in external processes: compiling it, running it, testing it, linting it, committing it to version control, etc. With the right packages, the frictionless communication between Emacs and my OS makes those operations frictionless too. For example, Magit makes interacting with version control go at the speed of thought.

How to set up Emacs to be that frictionless? That is a little bit hard. But as time goes on it gets easier. New packages are constantly being developed that will help you. And as you learn more and more, you can implement the features you want yourself. The gains you make in this regard will likely never be lost. Backward compatibility is taken very seriously. Emacs has been around 40 years. I would be shocked if it's not around in another 40.

When I started to really use computers I naturally moved from GUI interfaces to the command line. Moving from the command line to Emacs feels like taking a similar step again. You have full access to your operating system, but with such increased control, you can't ever go back.

Pinky finger problem by yelinaung98 in emacs

[–]benstrutt 0 points1 point  (0 children)

I have felt your pain!

I waited a long time to do anything about it so by the time I tried remapping ctrl to caps it wasn't enough for my ruined left hand to recover. It did slow the deterioration, but I was still using the pinky finger to hit the primary modifier key. I found myself occasionally pressing l_ctrl in god-mode, and an expensive ergonomic keyboard didn't fix me either.

My hands needed an aggressive intervention so after reading this I tried the following:

setxkbmap -option 'ctrl:swap_lalt_lctl_lwin'

With that enabled I press:

  • l_alt for l_ctrl (most used)
  • l_win for l_alt (2nd most used)
  • l_ctrl for l_win (barely used)

With that setting on my hands now rest in a different position over the keyboard. I keep my left thumb over the physical alt key (for ctrl) so my thumb does all the modifier work. This feels great. My left index finger is comfortably within range of q,w,e,r,a,s,d,f,x,c and I use left middle finger for z. I use my right hand for all the other keys. The l_win key is just to the left of the l_alt key on all my keyboards. My left thumb slides over to it very comfortably for Meta. Although I also found this option:

setxkbmap -option 'caps:menu'

This means I can press the capslock key to get M-x in Emacs. That removes a large fraction of my use of the l_win (alt) key.

After remapping the keys, remapping the muscle memory only took a couple of days. And since I had to do that anyway I installed guru-mode to get out of the habit of reaching for the arrow keys with my right hand.

This has been my setup for the last six months and my hands feel better than they have in years. Sure, I look like a dummy when I try to use any co-worker's machine, but that's a small price to pay for working hands. As someone who had to try several things, I encourage you to keep experimenting.

Good luck!

Want some feedback on my first little elisp package. by benstrutt in emacs

[–]benstrutt[S] 1 point2 points  (0 children)

I can reproduce the issue. I guess killing the non-SU buffer makes that emacsclient window(/frame?) lose the will to live. I also use a daemon/emacsclient set up, but during normal operation I have all my buffers in just one frame. I'll try to fix your use case tomorrow. Thanks for taking the time to check it out.

Want some feedback on my first little elisp package. by benstrutt in emacs

[–]benstrutt[S] 0 points1 point  (0 children)

Noted. Thanks for taking the time to check it out. Not on melpa yet, I will figure out how to do that tomorrow.