Recent Changes

Updates since 2021-07-25 12:23 UTC up to 2021-08-24 12:23 UTC

1 | 3 | 7 | 30 | 90 days
List all changes Include rollbacks Include minor changes
List later changes RSS RSS with pages RSS with pages and diff

2021-08-23

  • 04:22 UTC (new) (history) 2021-08-23 grep and context lines . . . . mbork Sometimes (well, actually pretty often!) I need to search text files with grep. By default, it displays all the lines that are matched by some regular expression. As is usual with heavily-used and battle-tested shell commands, it has numerous well-though arguments, like -H and -h (print or suppress the filename prefix in every line), -n (print the line number along with the matching line) and many others. A few weeks ago, however, I had an extremely specific need, and I was very pleasantly surprised that grep supported precisely my use-case. I wanted to grep a log file having a particularly annoying format, and I wanted grep to display every match together with one preceding and two following lines. Well, it turns out that grep has such a feature, too.
  • 04:21 UTC (diff) (history) Comments on 2021-08-16 Remapping commands . . . . mbork Well, you're right – but still, they solve a very similar problem. At least I couldn't think about a real-life situation when only one of them would . . .

2021-08-16

  • 16:49 UTC (new) (history) 2021-08-16 Remapping commands . . . . mbork Several weeks ago I wrote about a nice feature of Emacs where you can bind some command to every key bound to another command in some (other) keymap. Since then, I found another feature solving the same (or at least a very similar) problem – command remapping.

2021-08-09

  • 07:37 UTC (new) (history) 2021-08-09 Linking to manpage sections . . . . mbork Some time ago I was looking for some advice on StackOverflow, and one thing caught my eye: someone provided a shell command which apparently started man already showing some section. It is very simple, but still nice.

2021-08-02

  • 04:15 UTC (new) (history) 2021-08-02 Reordering sentences in Emacs . . . . mbork I’m probably in a minority, but I am a heavy user of Emacs’ transpose-* commands, most notably transpose-words and transpose-chars. This is probably because I have spent a lot of time editing texts in Emacs – not writing, but editing, and wrong order of words is a very common mistake I often needed to fix. One problem with transpose-words, though, is that it can only swap two words, usually two adjacent ones

2021-07-26

  • 06:10 UTC (new) (history) 2021-07-26 Binding a command to every key bound to another command . . . . mbork For today, I have an extremely specific Emacs Lisp tip – this is definitely not something you would use every day, but when you need it, it’s there. Assume that you are writing a mode (call it cool-mode), which should support some general Emacs command (call it do-something) – only the workings of this mode are so specific that this command should be basically written from scratch instead of using Emacs’ own do-something. You could (of course) advise do-something, but it seems cleaner to define cool-do-something instead. How do you bind it to the same keys it is normally bound to in Emacs? For bonus points, the user might have its Emacs customized (with global-set-key, for example) to bind do-something to a key of their choice.

More...

Filters