💾 Archived View for idiomdrottning.org › def-briefly-mode captured on 2023-09-28 at 16:07:41. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-04-19)
➡️ Next capture (2023-11-14)
-=-=-=-=-=-=-
Here’s an Emacs macro that lets you easily make modes turn on briefly and then turn themselves off after a while.
For example, let’s say you have smart-quotes-mode and you love it but you also want a smart-quotes-mode-briefly that when you call it turns smart quotes mode on for three seconds and then turns it off again.
(def-briefly-mode smart-quotes-mode 3 (smart-quotes-mode 1) (smart-quotes-mode -1))
You can bind this to something, type a few smart quotes and emdashes, and then it turns off.
Here’s another example. Let’s say you want to have the mark active for seven seconds after you have set mark. That’d be:
(setq select-active-regions nil);; Don't want to sent passwords to X clipboard (def-briefly-mode transient-mark-mode 7 (setq transient-mark-mode t mark-active t) (setq transient-mark-mode nil mark-active nil)) (advice-add 'set-mark-command :after #'(lambda (o) (transient-mark-mode-briefly)))
Here’s how to install it with straight.el.
(push '(idi "idiomdrottning.org" "") straight-hosts) (straight-use-package '(def-briefly-mode :host idi :repo "def-briefly-mode"))
With other package systems, I don’t know, but you can get a repo with:
git clone https://idiomdrottning.org/def-briefly-mode