* bug#68981: [PATCH] Add support for deriving major modes in which-func
@ 2024-02-07 19:51 Damien Cassou
2024-02-10 11:10 ` Stefan Kangas
0 siblings, 1 reply; 2+ messages in thread
From: Damien Cassou @ 2024-02-07 19:51 UTC (permalink / raw)
To: 68981
[-- Attachment #1: Type: text/plain, Size: 674 bytes --]
Tags: patch
Hi,
I wanted to configure which-func to activate only for programmation
modes so I wrote:
(use-package which-func
:init
(progn
(setq which-func-modes '(prog-mode)))
:config
(progn
(which-function-mode)))
But this doesn't work because which-func only checks for exact major
modes, not derived ones: because emacs-lisp-mode is not in
`which-func-modes`, I won't get which-func to activate in
emacs-lisp-mode even though I want it.
I wrote the attached patch so which-func uses `derived-mode-p'. This
solves my issue.
--
Damien Cassou
"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-support-for-deriving-major-modes-in-which-func.patch --]
[-- Type: text/patch, Size: 1513 bytes --]
From a0cda58b28ee0bebd38aa6d7d61546d3eeeedbc9 Mon Sep 17 00:00:00 2001
From: Damien Cassou <damien@cassou.me>
Date: Wed, 7 Feb 2024 20:41:44 +0100
Subject: [PATCH] Add support for deriving major modes in which-func
* lisp/progmodes/which-func.el (which-func-try-to-enable)
(which-func-ff-hook): Use `derived-mode-p' to check if the current
major mode is within `which-func-modes' or
`which-func-non-auto-modes'.
---
lisp/progmodes/which-func.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index bd68672f905..631cb3b0aef 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -211,7 +211,7 @@ which-func-try-to-enable
(when which-function-mode
(unless (local-variable-p 'which-func-mode)
(setq which-func-mode (or (eq which-func-modes t)
- (member major-mode which-func-modes)))
+ (apply #'derived-mode-p which-func-modes)))
(setq which-func--use-mode-line
(member which-func-display '(mode mode-and-header)))
(setq which-func--use-header-line
@@ -239,7 +239,7 @@ which-func-ff-hook
(condition-case err
(if (and which-func-mode
- (not (member major-mode which-func-non-auto-modes))
+ (not (apply #'derived-mode-p which-func-non-auto-modes))
(or (null which-func-maxout)
(< buffer-saved-size which-func-maxout)
(= which-func-maxout 0)))
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#68981: [PATCH] Add support for deriving major modes in which-func
2024-02-07 19:51 bug#68981: [PATCH] Add support for deriving major modes in which-func Damien Cassou
@ 2024-02-10 11:10 ` Stefan Kangas
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Kangas @ 2024-02-10 11:10 UTC (permalink / raw)
To: Damien Cassou, 68981-done
Version: 30.1
Damien Cassou <damien@cassou.me> writes:
> I wanted to configure which-func to activate only for programmation
> modes so I wrote:
>
> (use-package which-func
> :init
> (progn
> (setq which-func-modes '(prog-mode)))
> :config
> (progn
> (which-function-mode)))
>
> But this doesn't work because which-func only checks for exact major
> modes, not derived ones: because emacs-lisp-mode is not in
> `which-func-modes`, I won't get which-func to activate in
> emacs-lisp-mode even though I want it.
>
> I wrote the attached patch so which-func uses `derived-mode-p'. This
> solves my issue.
Thanks, pushed to master as commit 657d2c11337. Closing.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-10 11:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-07 19:51 bug#68981: [PATCH] Add support for deriving major modes in which-func Damien Cassou
2024-02-10 11:10 ` Stefan Kangas
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.