By default the modeline like:
Emacs displays Git-master
when I am working in a directory that is under the Git version control system.Now I customize modeline in the file init-modeline.el
like this:
(setq-default mode-line-format
(list
;; the buffer name; the file name as a tool tip
'(:eval (propertize "%b " 'face font-lock-keyword-face
'help-echo (buffer-file-name)))
;; line and column
"("
"%02l" "," "%01c"
") "
......
))
Then add (require 'init-modeline)
to init.el
.
Now emacs does not display git branch in the emacs modeline, so I add '(vc-mode vc-mode)
to init-modeline.el
like this:
(setq-default mode-line-format
(list
;; the buffer name; the file name as a tool tip
'(:eval (propertize "%b " 'face font-lock-keyword-face
'help-echo (buffer-file-name)))
;; line and column
"("
"%02l" "," "%01c"
") "
'(vc-mode vc-mode)
......
))
Now modeline shows like this:
It only shows -master
.How can I show Git-master
?
The value of variable vc-mode
in init-mode
buffer like:
vc-mode's value is #(" :master" 0 1
(face sml/vc-edited)
1 8
(help-echo "Locally modified file under the Git version control system\nCurrent revision: master\nmouse-1: Version Control menu" face sml/vc-edited local-map
(keymap
(mode-line keymap
(down-mouse-1 menu-item "Version Control" vc-menu-map :filter vc-menu-map-filter)))
mouse-face mode-line-highlight))
Local in buffer init.el; global value is nil
Automatically becomes permanently buffer-local when set.
This variable may be risky if used as a file-local variable.