GNU bug report logs - #40481
26.3; whitespace-enable-predicate: consider using derived-mode-p

Previous Next

Package: emacs;

Reported by: Jack Kelly <jack <at> jackkelly.name>

Date: Tue, 7 Apr 2020 09:27:01 UTC

Severity: wishlist

Tags: fixed

Found in version 26.3

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jack Kelly <jack <at> jackkelly.name>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.3; whitespace-enable-predicate: consider using derived-mode-p
Date: Tue, 07 Apr 2020 19:25:56 +1000
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'.




This bug report was last modified 4 years and 113 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.