text/gemini; lang=en
# def-briefly-mode
Here’s an Emacs macro that lets you easily make modes turn on briefly and then turn themselves off after a while.
## Usage
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.
```Code
(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:
```Code
(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)))
```
## Installation
Here’s how to install it with straight.el.
```Code
(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:
```Code
git clone https://idiomdrottning.org/def-briefly-mode
```
=> https://github.com/radian-software/straight.el straight.el
## History
I only made this because markdown-mode required active regions. I ended up instead changing that to just use normal regions and removed my briefly transient stuff. But I’m gonna keep maintaining this; you never know when I’m gonna need another briefly mode for something else.
=> https://github.com/jrblevin/markdown-mode/pull/812 Add option markdown-need-active-region by snan · Pull Request #812 · jrblevin/markdown-mode · GitHub
This content has been proxied by September (ba2dc).