Learning to use the Emacs keybindings

03.03.2019 11:37

I think I have written about this before, but I can’t remember. When I started to learn how to use Linux I first used nano, and then I got into VIM becuase the people that helped me used it. And obviously I became one of the people who mocked Emacs for being an OS.

Then Spacemacs hapened.

During the summer of 2018 I decided that I wanted to learn how to use the standard Emacs keybindings. I started doing it sometime in August, and now almost six months later I can say that I am somewhat competent using it. I’m not yet at the level where I can combine 25 shortscuts into someting nuts. But I’m at least advanced beginner or a beginning intermediate user.

This is how I went about doing this:

  1. I wrote down the basic commands I had to know, like saving files, opening files, quitting emacs, managing “windows” on a Index Card.
  2. I started a text file where I pasted interesting keybindings or answers to how to do something I used to do in VIM. And I used it as a FAQ while learning.
  3. Re-read Mastering Emacs.

The process was really slow and painful in the beginning. But after a few weeks, and getting stuff into my fingers it sped up. And today I actually prefer it to other keybindings.

The main reason I started learning it was because regular emacs with evil is kind of slow, and what I think when I’m at the other end of it is that Emacs makes a hell of a lot more sense after learning this.

Microsoft Sculpt Ergonomic Mouse

02.03.2019 19:26

So, I use Windows at work. It is not horrible, but I still hate it. I was looking for a mouse to have at home, just in case I had to work from home or something.

As I was looking I I realized that most of the options either was the same cheap Logitec thing I had at work, or something fancy with a million buttons or one of the two or three options that was good for my hand.

I decided to either get the cheapest possible or something that was good for my hands.

I decided to get this one from Microsoft because the other ergonomic one was from Logitec (you know the huge mouse with the big ball on it) almost three times as expensive.

This mouse is like a big flat ball. It is so large that you can rest your entire hand on top of it, instead of having to use moucles to hold up your hand. It is really comfortable to use, and I like it a lot.

I like it so much that I took the one I got to work and ordered a second one.

Surviving with two USB-C ports

02.03.2019 15:36

I started out with the idea that everything should be USB-C, when I first got my MacBook escape. But that is not working as long as you can’t get any C hubs.

What I have ended up with is a USB-C monitor, some chargers, a USB-C to A hub with four ports, some adapters and some very few USB-C versions of what I have for USB-A.

Having just two ports works, but I think it is far from ideal. And the minimum going forward should be 3 or 4; ideally way more.

The problem with USB-C is that you have USB-C and you have thunderbolt 3 both of them use the same plug but are very different.

The number of thunderbolt plugs you can have are a limit on the motherboard or logic board. And the number of USB ports are more or less without limits. But the latter have less features.

I think Apple should find some way to tell what is what and just have a lot of them on their Pro laptops. But it isn’t ideal.

Link dump

01.03.2019 17:48

The free IKEA pencil

24.02.2019 19:54

I have seen these free pencils at IKEA every single time I’ve been there. Which is too many times.

This pencil is not something I would have bought for myself, it is a thin, short pencil. The casing does not feel that great. But the core is prefectly fine. Maybe a little bit too hard for my taste.

When you hear “that free pencil they give away at IKEA” you expect them to be far worse than what it is.

Clojure and JDBC

24.02.2019 19:52

I love SQL, I know it well, and how to use it to make fast efficient operations that reflect what I want to do. It is not beautiful, but it works really well.

After starting with raw SQL, moving over to ORM’s of various types, mainly the Django one and Entity Framework, and a few abstractions that are kind of in the middle. Like for example Korma SQL, I’m back at regular SQL.

When I work in Clojure I use the JDBC bindings, and I use a very small section of it, because I don’t like most of the abstractions JDBC have added on top of SQL. I use the query and the execute! functions. The way you use JDBC(if you want to use it efficient) is that you use the with-db-connection macro to make sure that you don’t set up a new connection to the database for each operation.

Then you have the two methods, execute! is what you use when your query does not return any data, and query is what you use when it does. There are settings to control how the data are returned, if you want need that, everything from lists of lists to lists of maps, to functions etc (if you want it to be lazy)

JDBC is the option I prefer, it may not be the easiest option, but you don’t need to do all kinds of weird crap that you often need to when your abstraction of choice was not mad with your SQL command of choice in mind.

Emacs: defer or not

23.02.2019 20:40

If you start with plain emacs it will start very fast. More or less fast enough for you to not notice it. And for every plugin you add it will become a little bit slower. Some plugins contribute more to it than others. There are basically two ways to deal with this. Either to just let it load everything when you start Emacs or do defer it.

When you defer you either tell it to wait to do it after Emacs have started, or do this at a certain event.

I have tried many different combinations over the last year, and I have landed on not doing anything at all. The same kind of CPU time have to be spent no matter what you do. And I’d rather take another couple of sips of coffee while waiting for Emacs to load than to having to wait in the middle of something for something to load.

Another one on use-package

23.02.2019 16:57

I have written about use-package before, but I’m going to try again because I don’t think I got my point across.

Use-package is a emacs package that cotnains a macro called use-package, it makes it easy to deal with packages in a clean manner. n

If you take my typical emacs setup before emacs I had this long list of packages, that I looped over and checked if they were installed, if not I installed them. Then all of it was loaded and configured in a very speicifc manner to make sure it all worked. Use-package solves all of this.

The way it works is that it have a lot of different keywords that you can usem and the result is that you can avoid all kinds of nesting and weird issues, and just write the config in a way it makes sense to you. The reason I got started with it was because of the :ensure keyword, because that enabled me to install and load in one step.

Here is the documentation: https://jwiegley.github.io/use-package/keywords/. The way I have gone deeper and deeper into it is by starting simple and using new stuff as I see a place for it.

Rober Carro: On Power

23.02.2019 16:52

I’m a huge fan of Rober Carro’s books, it all started with his amazing book about Robert Moses, and then continued as I read an listened through all of his books about LBJ. They are amazing, and my all time favourite biographies because of how well you get to know both the good and bad sides to them.

They are great, but long, and kind of intimidating. On power on the other hand is a short audiobook on Audible; it is one of their original production thingies. It is a fantastic place to start. It gives you a entry point to his writing, and if what you hear there is interesting you can just jump into either the Power Broker or the LBJ books.

Tramp Mode

22.02.2019 22:49

Tramp mode in Emacs are awesome. It is a way you can use emages to naviagate into other contexts. Like over SSH to your sever, or into a Docker container or to access files as root.

This is one of those killer features of emacs, that are awesome. Some IDE’s have something similar, but tramp is way more flexible. And if Emacs doesn’t support it out of the box, youll probably find a plugin for it.