1

默认模式线如下: 在此处输入图像描述

Git-master当我在 Git 版本控制系统下的目录中工作时,Emacs 会显示。现在我在文件中自定义模式行,init-modeline.el如下所示:

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

然后添加(require 'init-modeline)init.el.

现在 emacs 不在 emacs 模式行中显示 git 分支,所以我添加'(vc-mode vc-mode)如下init-modeline.el

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

现在,modeline 显示如下:

在此处输入图像描述

它只显示。-master我怎样才能显示Git-master

缓冲区中变量的值,vc-mode如:init-mode

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.
4

0 回答 0