tips

Emacs Tip: org-clone-subtree-with-time-shift with negative shifts

org-clone-subtree-with-time-shift with negative shifts This post is at the weekly Emacs Tips Reddit thread1. I use org-clone-subtree-with-time-shift (C-c C-x c on an org heading) sometimes when I need richer agenda entries than using a repeater like <2023-09-25 Mon +1w>. This allows for better notes upon individual dates, as well as more nuanced control like “except those three Mondays”. This morning I accidentally started my clones a couple weeks in the future, meaning I missed today and next week.

emacs tip: selected-mode

Emacs tips and tricks Shared on the Emacs Tips, Tricks, &c. thread1 Use selected mode to set up a keymap that only applies when you have a selection. I use this every day. It’s great for indentation of an area, and I also use it for removing duplicate lines, doing replacements in region, and an org-specific one for creating a numbered list of the selection. https://github.com/Kungsgeten/selected.el Footnotes 1 This post is at https://www.

A tip to recover blank screens with EXWM

Intro Sometimes in EXWM when I switch machines to and plug in my dock to an already running system, one or two of my external monitors stay black1. Sometimes this also occurs when my smart-dock2 changes power levels to the dock. It has enough throughput to utilize my whole 100w power inlet, but its “smarts” mean that when I connect my USBC phone, for instance, the amount of power going out changes dramatically and the shift can “lose” my two HDMI monitors until I do the trick below.

Tip: BBDB mode for contact management

BBDB1 is one of those libraries that has been around for so long it would be highly irregular if we weren’t talking about Emacs. The size and age of the thing is what originally scared me away from it in favor of org-contacts2, which had the advantage of being orgmode but was deprecated a long time ago. With BBDB you don’t usually view the elisp database that lies beneath, instead using its robust interface to interact.

Anzu mode for incremental find-and-replace

Shared on the Emacs Tip & Tricks thread 1. Anzu is great for previewing your query-replace as you go; just remember not to attempt it on HUGE files as the preview (or at least, result counting) gets problematic. Also remember that if you are doing a regexp replace that has side-effects (e.g. incrementing a counter), the preview itself will also do all those side effects before you run the actual replace.

Tip: shortcut for kill-this-buffer

I have added the following shortcut, possible since exwm frees up my s- key: (exwm-input-set-key (kbd "s-<backspace>") 'kill-this-buffer) And, for when I am already in an emacs buffer, this added to my personal key map: (define-key map (kbd "s-<backspace>") 'kill-this-buffer) In any case, making a single-chord shortcut for kill-this-buffer has highlighted how often I use the command, and made work that much faster. Highly recommended!