* bug#6324: 24.0.50; vc modeline is not updated when buffer mode is changed
@ 2010-06-01 12:30 Alex Harsanyi
2010-06-09 1:14 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Alex Harsanyi @ 2010-06-01 12:30 UTC (permalink / raw
To: 6324
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)
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#6324: 24.0.50; vc modeline is not updated when buffer mode is changed
2010-06-01 12:30 bug#6324: 24.0.50; vc modeline is not updated when buffer mode is changed Alex Harsanyi
@ 2010-06-09 1:14 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2010-06-09 1:14 UTC (permalink / raw
To: Alex Harsanyi, 6324-done
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-06-09 1:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-01 12:30 bug#6324: 24.0.50; vc modeline is not updated when buffer mode is changed Alex Harsanyi
2010-06-09 1:14 ` Stefan Monnier
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.