From unknown Sun Aug 17 09:10:13 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#68981 <68981@debbugs.gnu.org> To: bug#68981 <68981@debbugs.gnu.org> Subject: Status: [PATCH] Add support for deriving major modes in which-func Reply-To: bug#68981 <68981@debbugs.gnu.org> Date: Sun, 17 Aug 2025 16:10:13 +0000 retitle 68981 [PATCH] Add support for deriving major modes in which-func reassign 68981 emacs submitter 68981 Damien Cassou severity 68981 normal tag 68981 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 07 14:52:10 2024 Received: (at submit) by debbugs.gnu.org; 7 Feb 2024 19:52:10 +0000 Received: from localhost ([127.0.0.1]:57949 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXnxq-00088m-Ds for submit@debbugs.gnu.org; Wed, 07 Feb 2024 14:52:10 -0500 Received: from lists.gnu.org ([2001:470:142::17]:49566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXnxo-00088a-KJ for submit@debbugs.gnu.org; Wed, 07 Feb 2024 14:52:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXnxT-0005WJ-Mt for bug-gnu-emacs@gnu.org; Wed, 07 Feb 2024 14:51:47 -0500 Received: from mail.reprendre.net ([2001:910:1410:501::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXnxR-0001AF-DS for bug-gnu-emacs@gnu.org; Wed, 07 Feb 2024 14:51:47 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 2EFF02C8EA3 for ; Wed, 7 Feb 2024 20:51:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cassou.me; s=dkim; t=1707335493; h=from:subject:date:message-id:to:mime-version:content-type; bh=Z/egC1oBbCUR6FeAmXXcUGg4s8l6/ViAlh1PgjSArNQ=; b=W77msAOmPaQKbSYtngFwQ0U6D0u+WhAsYqVsgOMnpJJPv2pxRBx5OL3/y4RBeU1NO74Pud YCv48NltkMNiXIRqR/bSNWE1tvKbVBetaKhmCfYbikxxYvuIQFZMHFL2I6ehVKFTIdfR9D K3JxXCtdd4mqiu+fFp+mOE4ASoB4onF5pQA/nYJuUNm9IBrxSwV4AlaHO4urI+fNYcjEzn knJc3IAYbIC3zgv1p+n5RtuWfSyiDlJ4QF1aBnliyoDFYCtmT3e9BiqxESAR7g/gIwzxKg 0eNO8t9Jk9lxpmh4pSZZeOtqwrtpbwLzkyGMmXS8fxdVuxERbQw/c9jd/AegBQ== From: Damien Cassou To: bug-gnu-emacs@gnu.org Subject: [PATCH] Add support for deriving major modes in which-func Date: Wed, 07 Feb 2024 20:51:31 +0100 Message-ID: <87jzngvyrg.fsf@cassou.me> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Last-TLS-Session-Version: TLSv1.3 Received-SPF: pass client-ip=2001:910:1410:501::1; envelope-from=damien@cassou.me; helo=mail.reprendre.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Add-support-for-deriving-major-modes-in-which-func.patch >From a0cda58b28ee0bebd38aa6d7d61546d3eeeedbc9 Mon Sep 17 00:00:00 2001 From: Damien Cassou 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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 10 06:10:54 2024 Received: (at 68981-done) by debbugs.gnu.org; 10 Feb 2024 11:10:54 +0000 Received: from localhost ([127.0.0.1]:33017 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYlG2-0005D4-6k for submit@debbugs.gnu.org; Sat, 10 Feb 2024 06:10:54 -0500 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:42207) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rYlG0-0005Cf-0a for 68981-done@debbugs.gnu.org; Sat, 10 Feb 2024 06:10:52 -0500 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-5601eb97b29so3318687a12.0 for <68981-done@debbugs.gnu.org>; Sat, 10 Feb 2024 03:10:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707563430; x=1708168230; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :from:to:cc:subject:date:message-id:reply-to; bh=54/f+6WpS/YQqa9XEE/ryb7dPA1ZNoKUWB4B4plJfus=; b=jeMq7kpWVpccnSVilExLHSYY0wY3rGMA9AAJZdpte+VOqpWfoiLfhnfffbovtc+Q2w z0NqeF/x0HuCmAKOl+WGcdIGbgcv79sAGar0atriQFh6TN2H17MfS57BnviUYcincaxO XSxrxjrnKjKmsBWH/U803iFXS7j08c8xl3d1Z8q60AH8TxsmEZQVNz2RkBc4QvPLtXgQ +RO0GzEI7ROutY+4b2kJXGu7ep62rlNcMBZAo06TXNRVAfJ3q/OcUsLRv4LJnlwwgTAa 45WoPCBpwgTd1Rr5k+OkwI8snW4dDXekGxQAC4el5Fb1W55Z9Ou/+amBZfBMRBsvGp5i C2UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707563430; x=1708168230; h=to:subject:message-id:date:mime-version:references:in-reply-to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=54/f+6WpS/YQqa9XEE/ryb7dPA1ZNoKUWB4B4plJfus=; b=PQbikU8imIhbxDNeDrVlb5kxWdPGe8FaC4ywWcUfsqh7emTCsSYy++xrdYRZJOGtFu lm2uWg60W5rc1i8X7WUg1FZpUjUfm/Y5z7Nhpfs6xFETJMS7FfdnZEEZ6F0RkPQ1bPBB SpNkRnEtFNnZ3kQTHi8KyleRG7fOWKZwMLGxXcPS6/Kfu+oPj7R4gGxVL9ivdeV6BvAc GxqnCp3lLNXegkPg0jZDX2W1Imjt72Md7tiBFmgzXS0kkWM+ejpVZzhMYX8hOEHs92Bw 6B3dBdRxpNaz+6Ny+CtIGShH+dF49jncOwFaLySUuxPsajV3Epr+Y7AZkOAMFkRy0Dyt Si8g== X-Gm-Message-State: AOJu0YzbrnN8IPbLs+HPWvbkraY9AV6Amd6esgPSkQbj8U8IMZIeG+x6 mhDs6Vpyk4FJq6MjPkGo0ngxcYJpUBAlywS+Z0VGKBk6QCl3+AspYq7zu7PoPaHYE5QMnyD1Nse yO0kqMR6NxoQzlSmRkZIE1IH4WR4mbcrGNss= X-Google-Smtp-Source: AGHT+IGMjpqzyLkXNSa6T+/9U/uNyuSHpSdNunxxtHMVvbvhum3EgvMrOxyvGPYEaD6qkVYy6o4cl8K+SMW5CFadmwo= X-Received: by 2002:a05:6402:e0f:b0:55f:cc6d:29b5 with SMTP id h15-20020a0564020e0f00b0055fcc6d29b5mr3632775edh.21.1707563430040; Sat, 10 Feb 2024 03:10:30 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 10 Feb 2024 05:10:29 -0600 From: Stefan Kangas In-Reply-To: <87jzngvyrg.fsf@cassou.me> References: <87jzngvyrg.fsf@cassou.me> MIME-Version: 1.0 Date: Sat, 10 Feb 2024 05:10:29 -0600 Message-ID: Subject: Re: bug#68981: [PATCH] Add support for deriving major modes in which-func To: Damien Cassou , 68981-done@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68981-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Version: 30.1 Damien Cassou 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. From unknown Sun Aug 17 09:10:13 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 09 Mar 2024 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator