[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6324: 24.0.50; vc modeline is not updated when buffer mode is change

From: Alex Harsanyi
Subject: bug#6324: 24.0.50; vc modeline is not updated when buffer mode is changed
Date: Tue, 1 Jun 2010 20:30:12 +0800

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

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)
        ((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

4/ Notice that the VC version in the mode line does not change.

In GNU Emacs (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.

(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 via email to

[Prev in Thread] Current Thread [Next in Thread]