(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

2018-04-21 counsel-rg and symbol at point

Continuing my streak about counsel, I had a small a-ha moment a few days ago.

I often use counsel-rg. It was rather annoying for me that I had to mark the function or variable name at point, copy it to the kill ring, invoke counsel-rg and then yank it back.

Until I realized that all this was unnecessary. It turns out (and this is even mentioned in the manual) that you can use the normal feature of Emacs, which is clairvoyance. No, seriously. When Emacs presents you with some choice to be made in the minibuffer, usually you can press M-p to go back in the history, and then M-n to go forward again. However, if you start with M-n, you move in the minibuffer history into the future, which is a probable “dwim” (do-what-I-mean) choice. If you run counsel-rg with active region, this means that M-n will fill the minibuffer with its contents. If the region is not active, it will be the symbol or url at point.

By the way, a similar thing works in swiper, too. Here we can even have two choices (at least in programming modes): just the symbol at point or the symbol at point surrounded by \_< ... \_> (which makes sense, since this means boundaries of a symbol).

Anyway, the tradition continues: if you use Emacs and at some point think “I’d like Emacs to have some feature”, chances are pretty good that it’s already supported.

CategoryEnglish, CategoryBlog, CategoryEmacs

Comments on this page