Subject: bug#40714: closed (Re: bug#40714: Acknowledgement (Reinitialising the major mode disables which-function-mode.))

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 20 May 2020 18:09:02 +0000

Your bug report

#40714: Reinitialising the major mode disables which-function-mode.

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
40714: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=40714
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#40714: Acknowledgement (Reinitialising the major mode disables which-function-mode.)
From: Alan Mackenzie <[email-masked]>
To: [email-masked]
Date: Wed, 20 May 2020 18:08:42 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Bug fixed in master.

-- 
Alan Mackenzie (Nuremberg, Germany).

Subject: Reinitialising the major mode disables which-function-mode.
From: Alan Mackenzie <[email-masked]>
To: [email-masked]
Date: Sun, 19 Apr 2020 11:12:33 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello, Emacs.

In a typical buffer, say an emacs-lisp-mode buffer, with
which-function-mode enabled and working, do

    M-x emacs-lisp-mode

.  which-function-mode is no longer working.

#########################################################################

The cause of this is that the enablement of w-f-m is stored in a buffer
local variable which-func-mode.  This local variable gets killed on
reinitialising the major mode.  There is nothing to set it to non-nil
again.

When visiting a file, which-func-mode gets set in a file-find-hook
function called which-func-ff-hook.

Suggested fix: Move which-func-ff-hook to after-change-major-mode-hook
(renaming it, of course).

-- 
Alan Mackenzie (Nuremberg, Germany).