Sunday, August 25, 2019

kill windows process by name

taskkill /im chosenproc.exe /f

Why it is easier to write a plugin for Emacs than VScode

As a long time emacs user I’m comfortable with Emacs, but I heard so much about VSCode that I gave it a try.

It’s certainly nice, many things work out of the box, the command palette is a nice touch (though a far cry from using Emacs with Helm) and the fact that most thing is accessible via the keyboard makes it a viable alternative.

So it’s like Emacs for the modern ages. Accessible, programmable. I can see myself using it for something in case it provides better support for some langugage than Emacs, though I still prefer Emacs, especially if LSP gives it equal footing in the future in terms of language support.

I tried to create a simple extension too and it was not too hard, but it required trial and errors and reading other extensions’s codes, because the documentation is pretty sparse.

The main takeaway about extensions for me is that VSCode provides an API which you have to use and it’s adequate if it provides the necessary access, but also limiting, because you can’t do things for which the vscode devs haven’t added support yet.

Also, the process of writing an extension is much more convoluted. You have to create an extension template with an npm command which fetches lots of packages into node_modules. Then you code the extension in vscode and trying it involves firing up an other vscode instance. There were mysterious errors when the extension did not work, but there were no error messages anywhere in the debug panel (turns out a node module I tried to use was not installed, but it was never reported to me, I only saw the error: the extension failed to start or something.)

Compared to this in emacs you simply evaluate some code in a buffer and it instantly becomes part of the editor. You are not limited by an API, because you can access the whole editor system. You can override core functions, etc. Of course, the greater power comes with greater responsibilities: you can break the editor if you reach too deep and not careful enough.

Conclusion: VScode is really nice, I like it, but I stil prefer emacs, because it makes it so easy to write extensions, you don’t even have to think about it. A small piece of code would be handy for a quick task? You just write it and it’s part of the editor. No registering an extension, no attaching to specific contribution points, no providers, etc. You just access what you need.

Thursday, August 22, 2019

elisp get time in seconds since the epoch

(string-to-number (format-time-string “%s” (current-time)))

Sunday, August 18, 2019

firefox increase menu font size, bigger font

  1. In a new tab, type or paste about:config in the address bar and press Enter. Click the button accepting the risk.
  2. In the filter box, type or paste devp and pause while the list is filtered
  3. Double-click layout.css.devPixelsPerPx and change its value to 1.5 and click OK. That corresponds to 150% of the classic font size.
Too big? Try 1.25
Too small? Try 2.0
Don’t choose a value below 1.0 or about 4.0 or you may find it difficult to get back to a viewable Firefox! If something does go terribly wrong, right-click the preference and then tap the R key to reset to the starting value.
https://support.mozilla.org/en-US/questions/1239467

Thursday, August 1, 2019

ripgrep ignore files with glob

The iglob parameter overrides all the ignore files, so you have to repeat every ignore if you use iglob on the command line to ignore things:

rg --files --iglob  !logs/  --iglob  !cache/ --iglob  !images/ --iglob  !obsolete/   --iglob "!*log" --iglob "!*.orig" --iglob "!*~" --iglob "!*min.js"