GNU bug report logs -
#6324
24.0.50; vc modeline is not updated when buffer mode is changed
Previous Next
Reported by: Alex Harsanyi <harsanyi <at> mac.com>
Date: Tue, 1 Jun 2010 13:22:02 UTC
Severity: normal
Found in version 24.0.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6324 in the body.
You can then email your comments to 6324 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6324
; Package
emacs
.
(Tue, 01 Jun 2010 13:22:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Alex Harsanyi <harsanyi <at> mac.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 01 Jun 2010 13:22:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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:
<help-echo> <help-echo> C-x 1 C-x C-f P r o <tab> E
M <tab> t e <tab> <return> <down> <return> M-x n o
r m <tab> m o <tab> <return> <down> <down> <up> <down>
<return> k j f d s <return> 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 <backspace> <backspace>
<backspace> v e <tab> r <tab> t <tab> <return> y e
s <return> M-x r e p o <tab> r <tab> <return>
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)
Reply sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
You have taken responsibility.
(Wed, 09 Jun 2010 01:15:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Alex Harsanyi <harsanyi <at> mac.com>
:
bug acknowledged by developer.
(Wed, 09 Jun 2010 01:15:03 GMT)
Full text and
rfc822 format available.
Message #10 received at 6324-done <at> debbugs.gnu.org (full text, mbox):
> 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
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 07 Jul 2010 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 15 years and 42 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.