help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grokking cl-callf


From: Filipe Silva
Subject: grokking cl-callf
Date: Mon, 10 Jul 2017 15:46:02 -0300

A few days ago Stefan Monier gave me an awesome tip about cl-callf:

this snippet:

(if display-line-numbers-current-absolute
(setq display-line-numbers-current-absolute nil)
(setq display-line-numbers-current-absolute t)))

is equivalent to this line:

(cl-callf not display-line-numbers-current-absolute)

So In the same spirit, I'm trying to write a function that toggles showing
line numbers:

to display line numbers:

(setq display-line-numbers 'visual)

to hide line numbers:

(setq display-line-numbers nil)

can I use cl-callf in this case to avoid writing the obvious if bounded
function?

thanks in advance.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]