* grokking cl-callf
@ 2017-07-10 18:46 Filipe Silva
2017-07-10 21:00 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Filipe Silva @ 2017-07-10 18:46 UTC (permalink / raw)
To: Help Gnu Emacs mailing list
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: grokking cl-callf
2017-07-10 18:46 grokking cl-callf Filipe Silva
@ 2017-07-10 21:00 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2017-07-10 21:00 UTC (permalink / raw)
To: help-gnu-emacs
> So In the same spirit, I'm trying to write a function that toggles showing
> line numbers:
I recommend you don't use that code.
For that, better use `define-minor-mode`.
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-10 21:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-10 18:46 grokking cl-callf Filipe Silva
2017-07-10 21:00 ` Stefan Monnier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).