2020-12-28 Update

There was another Emacs meetup in early December. The turnout was pretty good. I think there were six or seven people online.

One of the presentations was about building regular expressions in Emacs. A few people were frustrated that Emacs reg-exes are not compatible with Perl or Java reg-exes. I don’t remember too much about the other presentation topic. I am not really interested in dealing with package managers right now.

I pointed out after the presentations that the 2020 EmacsConf had just happened the week before. I asked if anyone knew about it, but nobody did. I only knew about it because I had looked at Sacha Chua’s website a couple of days before the meetup. At some point I will go through some of the videos that look interesting to me. Many of them are 10 minutes long. There are quite a few on org-mode.

On the front page there are links to EmacsConfs for prior years.

One of the 2020 talks was a guy who used Emacs to write a novel. I wonder if it has or will get published. I have never written or published a book; I thought that the publishing industry revolves around MS Word (which I hate). Norman Richards was at the meetup, and he has published a few books (a page about him on O’Reilly’s site, and a couple of books at Manning that he contributed to here and here). He said that not all human editors require MS Word.

Afterwards, I ordered the org-mode course from Udemy. It was on sale and they said it never expires, so why not?

You’re welcome.

2020-11-29 Update

I attended the local Emacs meetup a few weeks ago.

I mentioned I am getting into Org mode. Someone said I should look at Org-Agenda. There is also Org-roam which attempts to replace Roam in Org-mode. It looks interesting. I will put it on my ever-expanding to-do list.

We also talked about how there are a lot of emacs start kits out there, like Prelude, Doom Emacs and Spacemacs. I think there are a few others. I noticed that a high percentage are based on evil-mode. The appropriately named Evil mode is a vi emulator running in Emacs. I wonder if there was a push a few years ago to get vi people to move to Emacs, or if something happened in the vi world to make some people look for an alternative.

I first got into Emacs about 20 years ago at my first programming job. All the developers had Sun workstations. Someone showed me vi, and it was (and still is) bizarre. I think the idea of modes is stupid (at least the way vi implements them; “modes” in Emacs are more like add-ons or plug-ins for other apps, and you can run several at once). Someone showed me Emacs. I said “What happens in Emacs when you press the ‘a’ key?” The guy said: “The letter ‘a’ is added to the file whereever the cursor is. Just like almost ever other text editor on the planet.” I told him to show me more Emacs.

If you had to toggle a database between read-mode and write-mode, you would quickly find another database. Vi is like the Unix version of the Microsoft paper clip: “I see you are editing text. Do you want the text to actually appear in this file?” Yes, that would be great. And to all the people who say they use vi because it is on all Unix systems, that is not too different than people using Windows because that’s what the computer came with, or using Office because everybody else does. That’s not better, that’s just inertia.

WRT which is better: Emacs can do vi, but vi cannot do Emacs. I think that settles it.

I did start making a few tables in org-mode. My tire pressure sensor kept going off, but it does not tell me which tire. So every time I filled my tires up, I would fill up a tire, turn my car back on, and see if the sensor was still flashing. I would repeat that for each tire until I was clear. It only took a couple of times to figure out it was the same tire. But I made a list with the date and which tire. I realized one way to learn org-mode is that every time you have a problem, ask yourself if org-mode can help. So now I know a little about tables in org-mode.

I still have an org-file that I am using as a to-do list. I think that every month I will update it by getting rid of all the tasks that are done, and archive it.

There is another Emacs meetup this week. Perhaps knowing more Emacs users will help me in my goal of finding a job where I do not have to use any Microsoft software every. Keep in mind I am not an Apple person; I have realized that when I tell people I do not want to deal with MS, they just assume that I am an Apple fanboy.

I am almost done with the Go tutorials on Pluralsight. I have one more to go through, then it is back to Spring and on to Kotlin. But I might take a detour into the one Elixir course. I am still tired of typing “if err != nil”, but I found my chi-balls, so typing does not hurt as much.

One of them took me a while. The instructor was using MySql, and I decided to use Postgres. I went to the list of Go SQL drivers and I used pq for a while, but since it is deprecated I switched to pgx I had to upgrade my version of Go, and I had to change some of the code for the driver. With pq I could just use the standard Go libraries, but with pgx your code has to become pgx-specific.

At some point, I plan on writing more about why I am interested in Lisp, and also thoughts on my ideal job. Before I got the job I am at now, I interviewed with National Instruments. I thought it went well, up until the final question. He asked me to describe what I thought would be an ideal job within the company. How can you get that wrong? Maybe I was supposed to say that I would have to work there and see what they have to offer and what it is like before I could answer that question. Or maybe I did, and for some reason that was the wrong answer. Or maybe I said something that made him think I was crazy. But lately I have been thinking about that question, and I will start writing down some answers.

You’re welcome.

Starting Org Mode

I have started trying out Org mode.

Granted, this is not the first time. But this time I am going to go slowly. I keep reading posts from people that Org changed their life, and my life certainly needs changing. My ideal job would involve no Microsoft products at all (do not assume I am an Apple user when I say that). I need to learn more about the useful tools if I want that to happen.

So far there is not much to report. I am making a text file with commands and keybindings as I learn them. I will eventually put it on my site for my own reference. If other people find it useful, that’s great. At every job I have ever had, there are always a lot of people who want to keep everything in their heads. It’s like there is some contest to see who can keep the most mental plates spinning. I really hate playing that game. Hopefully, Org mode can reduce my cognitive burden.

You’re welcome.

Emacs Tricks With Go

I am still going through some Go tutorials. I am using Emacs as my editor.

There are some things that the go mode does not handle well; I don’t know if this is a shortcoming in the mode, or if I am using an old version, or if there is some conflict with another mode I am using. It’s actually a minor point.

It does not indent switch statements the way I want. All the “case” statements and everything inside them is indented as far as the “switch”. Hitting tab does not work. I have to hit “space” for every line. It gets pretty tedious.

But I found a way to do it:

  • set-mark-command (C-@) and highlight the region
  • indent-rigidly (C-x TAB)
  • hit the arrow key as many times as I need. This will indent all the lines the same amount.

 

I also learned something about opening files. I had a directory with a file called “time.go” and “showtime.go”. When I tried find-file (C-x C-f), or switch-to-buffer (C-x b), it kept picking up “showtime.go”, even though I wanted “time.go”. I was able to open “time.go” with find-alternate-file (C-x C-v). Then I had to re-open “showtime.go”. It’s not a perfect solution, but it worked for me.

These commands are not unique to the Go mode.

You’re welcome.

A Hacker News Comment About Emacs

I have started using Emacs a bit more lately. I spent a bit of time upgrading packages and getting CIDER to work. I would like to share a comment that was left by someoneĀ  going by “maehwasu” (perhaps a disciple of Deganawida) on Hacker News on August 26, 2015 (or whatever day was 818 days ago from today).

OP is getting hate, but I write a lot of Clojure code in Emacs, and I find the following commands cover 97%+ of my usage, maybe more. For config I use Emacs Live out-of-the-box, and remap Command on OSX to be my Ctrl. That’s it.

C-a, C-e, C-b, C-f, C-p, C-n, C-v, M-v for line/screen maneuvering.

C-o for Ace-jump to go to the start of any words I see on the page.

C-d to delete. C-s to search for words not on the page.

C-k, C-y, and also how to use them with paredit to yank whole s-expression chunks.

Buffer switching and killing.

File saving and opening.

I teach the above to any friends who want to learn Emacs/Clojure/LISP, leaving out a few other features like whole word deletion and more advanced paredit. With halfway decent aptitude and a little practice, they become productive very quickly (within a few hours, which is a pretty good investment relative to “normal” text editors in my book).

Note: I have a post on Emacs buffers here.

You’re welcome.

Notes On Using Emacs Buffers

A few keyboard commands to use multiple buffers in Emacs:

2020-09-20 Note:

In Emacs, a “window” is another emacs file open in the same terminal. It does not mean “window” in the sense of another open application on your system. You can have multiple buffers open, but only one or two showing in emacs windows. What is called a “window” in other contexts (like OSes) are called “frames” in Emacs. Here is a question on the Emacs Stack Exchange with a picture explaining it.

Usually, buffers are files. But there is also a help buffer, a messages buffer, and sometimes other buffers. For example, if you working with some variant of Lisp, you can hook your REPL into Emacs, and there could be a buffer running your REPL.

You can also list the buffers using M-x list-buffers. One difference is that C-x C-b will open the list in the same window if you only have one window showing. M-x list-buffers will open a second window if you only have one showing.

You’re welcome.