* bug#40481: 26.3; whitespace-enable-predicate: consider using derived-mode-p
@ 2020-04-07 9:25 Jack Kelly
2021-01-28 7:40 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Jack Kelly @ 2020-04-07 9:25 UTC (permalink / raw)
To: 40481
I use whitespace-global-mode to turn on whitespace highlighting in most
buffers. In my version of emacs, modes can be blacklisted by setting
`whitespace-global-modes' to e.g., `(not foo-mode bar-mode)'.
This is implemented by `whitespace-enable-predicate', which calls
`(not (memq major-mode (cdr whitespace-global-modes)))`.
I am a heavy user of magit, and find whitespace highlighting distracting
when using it. Magit implements a lot of modes, all inheriting from a
common `magit-mode'. I would like to blacklist all such modes from
`whitespace-mode', which I have currently done with the following
advice:
(add-function :filter-return whitespace-enable-predicate
(lambda (ret) (and ret (not (derived-mode-p 'magit-mode)))))
It would be quite convenient if `whitespace-enable-predicate' called
`derived-mode-p' instead of `memq major-mode'.
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#40481: 26.3; whitespace-enable-predicate: consider using derived-mode-p
2020-04-07 9:25 bug#40481: 26.3; whitespace-enable-predicate: consider using derived-mode-p Jack Kelly
@ 2021-01-28 7:40 ` Lars Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-28 7:40 UTC (permalink / raw)
To: Jack Kelly; +Cc: 40481
Jack Kelly <jack@jackkelly.name> writes:
> It would be quite convenient if `whitespace-enable-predicate' called
> `derived-mode-p' instead of `memq major-mode'.
Makes sense. I've now made this change in Emacs 28 (and noted it in
NEWS).
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-28 7:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07 9:25 bug#40481: 26.3; whitespace-enable-predicate: consider using derived-mode-p Jack Kelly
2021-01-28 7:40 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).