(redirected from Homepage)

Strona domowa

Witam na mojej prywatnej stronie internetowej!

[If this is all Polish to you, click here: English]

Uwaga: z oczywistych powodów nie mogę zagwarantować swojej nieomylności, choć staram się o zgodność tego, co piszę, z Prawdą. Jest również oczywiste, że nie gwarantuję takiej zgodności w przypadku komentarzy. Umieszczenie linku do strony spoza niniejszego serwisu nie musi oznaczać, że podzielam poglądy autora tej strony, a jedynie, że uważam ją za wartościową z takich czy innych powodów.

Marcin ‘mbork’ Borkowski

2025-12-08 Some new additions to Emacs

While I’ve been compiling my Emacs from source code for a very long time, I do not do that very often. I’m still excited by the cool new things Emacs developers cook for us all, but I don’t have time (nor do I remember) to git pull and make all my Emacs very often.

However, I did it a few days ago, and was greeted with three surprises – two fantastic ones and one less so.

The less fantastic one means that some time before my last compilation of Emacs, the developers decided to issue a warning whenever Emacs loads a file without a “lexical binding cookie”. Don’t get me wrong – this is a very reasonable and expected change – but it means that my Emacs suddenly became very grumpy. Of course, this is (a bit) my fault – I load lots of small Elisp files at Emacs start, and the vast majority do not have the lexical binding cookie – but I also load autogenerated files (for example, files created by AUCTeX), and they don’t have the cookie. (Of course, I updated AUCTeX and now those files do get the cookie, but this means that I’ll have to regenerate all of them. Not a big deal, but a tiny bit of a hassle.)

Let’s now talk about one of the better surprises. In this version of Emacs, when I place the point on an “added” or “deleted” line in Diff buffers, and the line is actually changed (so it has a corresponding “deleted” or “added” line somewhere close), the place corresponding to the one I’m on is highlighted using the smerge-refine-shadow-cursor face. Even though it seems a little bit distracting, I like it a lot. I look at diffs very often, usually (but not always) in Magit buffers, and being able to orient myself in the diff this way can be extremely helpful.

I’m not sure how robust this feature is – I mean, I have a very high opinion about Emacs devs, but diff itself is not very robust (since it is line-based and doesn’t take the code structure into consideration), so I expect weird behavior from time to time. But that is not really a problem for me – in these cases I usually resort to difftastic anyway.

But wait, there’s more! The bleeding edge has another great addition – fill-paragraph-semlf. This is something many people seem to want, and also something many people coded themselves or copied from some blog or wiki. It is basically a fill-paragraph smart enough to begin each sentence on a separate line. At first, I was tempted to remap M-q to this new function, but I was a bit afraid to use it in Org mode. It has its own org-fill-paragraph command, which apparently does something more (or something else?) than just calling fill-paragraph. However, I looked at the code of fill-paragraph-semlf, and it turns out that it’s actually very simple – this is its main part:

(let ((fill-region-as-paragraph-function
       #'fill-region-as-paragraph-semlf))
  (fill-paragraph justify region)))

So, I decided to put

(setq fill-region-as-paragraph-function
      #'fill-region-as-paragraph-semlf)

in my init file and from now on I get the new behavior whenever I press M-q both in Org mode and for example emails. (I’m not yet sure if I want that in emails.) Bad news is that it doesn’t work in AUCTeX, which has its own filling command. This is what I found in the AUCTeX sources:

;; The content of `LaTeX-fill-region-as-para-do' was copied from the
;; function `fill-region-as-paragraph' in `fill.el' (CVS Emacs,
;; January 2004) and adapted to the needs of AUCTeX.

Well, I guess I’ll just have to live with it. (I don’t use TeX very often these days anyway.)

To sum it up, if you haven’t consider compiling Emacs from source yet, now you have some good reasons! Of course, you can also wait until these features land in a new official version, though I have no idea when this is going to happen. (New Emacs versions are released fairly often these days, so probably not more than a few months.)

CategoryEnglish, CategoryBlog, CategoryEmacs

Comments on this page

More...