From unknown Fri Aug 15 15:30:06 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#6324 <6324@debbugs.gnu.org> To: bug#6324 <6324@debbugs.gnu.org> Subject: Status: 24.0.50; vc modeline is not updated when buffer mode is changed Reply-To: bug#6324 <6324@debbugs.gnu.org> Date: Fri, 15 Aug 2025 22:30:06 +0000 retitle 6324 24.0.50; vc modeline is not updated when buffer mode is changed reassign 6324 emacs submitter 6324 Alex Harsanyi severity 6324 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 01 09:21:57 2010 Received: (at submit) by debbugs.gnu.org; 1 Jun 2010 13:21:57 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJRPo-00079E-RB for submit@debbugs.gnu.org; Tue, 01 Jun 2010 09:21:57 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJQc1-0006lZ-Bq for submit@debbugs.gnu.org; Tue, 01 Jun 2010 08:30:30 -0400 Received: from lists.gnu.org ([199.232.76.165]:57572) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OJQbw-0004en-7p for submit@debbugs.gnu.org; Tue, 01 Jun 2010 08:30:24 -0400 Received: from [140.186.70.92] (port=52171 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJQbu-0002Mv-GF for bug-gnu-emacs@gnu.org; Tue, 01 Jun 2010 08:30:23 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJQbr-00013Q-MU for bug-gnu-emacs@gnu.org; Tue, 01 Jun 2010 08:30:22 -0400 Received: from outbound-mail04.westnet.com.au ([203.10.1.245]:58247) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJQbr-00012l-A8 for bug-gnu-emacs@gnu.org; Tue, 01 Jun 2010 08:30:19 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AocXALCZBEw6B8VNPGdsb2JhbAAHh2KWVgEBAQE1vz6FFgSDRg X-IronPort-AV: E=Sophos;i="4.53,340,1272816000"; d="scan'208";a="42891473" Received: from dsl-58-7-197-77.wa.westnet.com.au (HELO [10.0.1.2]) ([58.7.197.77]) by outbound-mail04.westnet.com.au with ESMTP/TLS/AES128-SHA; 01 Jun 2010 20:30:13 +0800 From: Alex Harsanyi Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: 24.0.50; vc modeline is not updated when buffer mode is changed Date: Tue, 1 Jun 2010 20:30:12 +0800 Message-Id: <94635060-11A1-4E76-B21D-0B4F145D4988@mac.com> To: bug-gnu-emacs@gnu.org Mime-Version: 1.0 (Apple Message framework v1078) X-Mailer: Apple Mail (2.1078) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 01 Jun 2010 09:21:55 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.0 (------) There is a problem with updating the mode line for VC operations when the buffer mode is changed. The easiest way to reproduce using mercurial is as follows (the problem should exist for every version control): The VC mode uses the `mode-line-hook' variable to update the mode line. This variable is set up in `vc-find-file-hook' and it is made buffer local. The problem is that this variable should have a 'permanent-local property set. If it does not, changing the buffer mode runs `kill-all-local-variables' which removes it from the buffer. From than on, the VC mode line will no longer be updated when the file is checked in, etc. I found out this problem when I opened a text file (.txt extension) and switched the major mode to rst-mode. Here is a patch that corrects the problem: --- lisp/vc-hooks.el 2010-04-09 17:19:53 +0000 +++ lisp/vc-hooks.el 2010-06-01 12:24:32 +0000 @@ -877,6 +877,7 @@ current, and kill the buffer that visits (when buffer-file-name (vc-file-clearprops buffer-file-name) (add-hook 'mode-line-hook 'vc-mode-line nil t) + (put 'mode-line-hook 'permanent-local t) (let (backend) (cond ((setq backend (with-demoted-errors (vc-backend buffer-file-name))) Here are some detailed steps to reproduce the problem: 1/ First create a test repository: $ mkdir test.hg $ cd test.hg/ $ hg init $ echo "Hello World" > hello.txt $ hg add hello.txt $ hg commit -m "Initial" hello.txt 2/ In emacs, open the file hello.txt, than execute "M-x normal-mode RET" 3/ Note the VC version in the mode line, modify the file and check it in. 4/ Notice that the VC version in the mode line does not change. In GNU Emacs 24.0.50.1 (x86_64-apple-darwin10.3.0, NS apple-appkit-1038.29) of 2010-06-01 on karinji-2.local Windowing system distributor `Apple', version 10.3.1038 configured using `configure '--with-ns'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_AU.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Text Minor modes in effect: show-paren-mode: t global-cwarn-mode: t display-time-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t size-indication-mode: t line-number-mode: t Recent input: C-x 1 C-x C-f P r o E M t e M-x n o r m m o k j f d s C-x C-s C-x v v C-c C-c C-x v l C-x 0 M-x r e n v e v e r t y e s M-x r e p o r Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Loading vc-hg...done byte-code: End of buffer Saving file /Users/haral/Projects/Emacs/test.hg/hello.txt... Wrote /Users/haral/Projects/Emacs/test.hg/hello.txt Mark set Press C-c C-c when you are done editing. Enter a change comment. Type C-c C-c when done Checking in /Users/haral/Projects/Emacs/test.hg/hello.txt...done Making completion list... [3 times] Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr message rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader emacsbug help-mode view log-view wid-edit log-edit easy-mmode ring pcvs-util add-log vc vc-dispatcher vc-hg dired uniquify paren avoid cwarn cus-start cus-load appt diary-lib diary-loaddefs cal-menu calendar cal-loaddefs time tex-site folding-isearch folding advice help-fns advice-preload protbuf warnings server midnight time-stamp whitespace iswitchb cc-mode cc-menus cc-cmds ah-bufsel ah-cc-mode-extra cc-styles cc-align cc-fonts cc-engine cc-vars cc-defs regexp-opt ah-util autoinsert cl cl-19 tooltip ediff-hook vc-hooks lisp-float-type mwheel ns-win easymenu tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces cus-face files text-properties overlay md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process ns multi-tty emacs) From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 08 21:14:23 2010 Received: (at 6324-done) by debbugs.gnu.org; 9 Jun 2010 01:14:23 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OM9s6-0001YD-QV for submit@debbugs.gnu.org; Tue, 08 Jun 2010 21:14:22 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OM9s4-0001Y8-F1 for 6324-done@debbugs.gnu.org; Tue, 08 Jun 2010 21:14:21 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAD+HDkxFxIwr/2dsb2JhbACeRHLAAIUWBIxo X-IronPort-AV: E=Sophos;i="4.53,387,1272859200"; d="scan'208";a="67639431" Received: from 69-196-140-43.dsl.teksavvy.com (HELO pastel.home) ([69.196.140.43]) by ironport2-out.pppoe.ca with ESMTP; 08 Jun 2010 21:14:15 -0400 Received: by pastel.home (Postfix, from userid 20848) id 9E71D8175; Tue, 8 Jun 2010 21:14:15 -0400 (EDT) From: Stefan Monnier To: Alex Harsanyi , 6324-done@debbugs.gnu.org Subject: Re: bug#6324: 24.0.50; vc modeline is not updated when buffer mode is changed Message-ID: References: <94635060-11A1-4E76-B21D-0B4F145D4988@mac.com> Date: Tue, 08 Jun 2010 21:14:15 -0400 In-Reply-To: <94635060-11A1-4E76-B21D-0B4F145D4988@mac.com> (Alex Harsanyi's message of "Tue, 1 Jun 2010 20:30:12 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 6324-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Here is a patch that corrects the problem: > --- lisp/vc-hooks.el 2010-04-09 17:19:53 +0000 > +++ lisp/vc-hooks.el 2010-06-01 12:24:32 +0000 > @@ -877,6 +877,7 @@ current, and kill the buffer that visits > (when buffer-file-name > (vc-file-clearprops buffer-file-name) > (add-hook 'mode-line-hook 'vc-mode-line nil t) > + (put 'mode-line-hook 'permanent-local t) > (let (backend) > (cond > ((setq backend (with-demoted-errors (vc-backend buffer-file-name))) Thank you very much for the test case and the patch. I've installed a slightly more extensive fix in the emacs-23 branch. Stefan From unknown Fri Aug 15 15:30:06 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 07 Jul 2010 11:24:04 +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