我在我的笔记本电脑(emacs 23.3)上定制了我的模式行,它运行完美。
但是当我试图让它在我的学校桌面上工作时(emacs 21.4)它在使用Ctrl- f,Ctrl- b,Ctrl-a等时不会更新,除非我实际修改了缓冲区。
我做了一个case语句来根据我所在的计算机更改代码,所以所有的功能都可以正常工作,只是模式线在移动点时没有更新
我尝试执行以下操作
(add-hook 'move-beginning-of-line 'force-mode-line-update)
(add-hook 'move-end-of-line 'force-mode-line-update)
(add-hook 'forward-char 'force-mode-line-update)
(add-hook 'backward-char 'force-mode-line-update)
(add-hook 'next-line 'force-mode-line-update)
(add-hook 'previous-line 'force-mode-line-update)
但是还是没有更新
有什么建议么?
代码:
(setq-default mode-line-format
(list
"---- "
;; Modified shows *
"["
'(:eval
(if (buffer-modified-p)
"*"
(if buffer-read-only
"!"
" "
)))
"] "
;; Buffer (tooltip - file name)
'(:eval (propertize "%b" 'face 'bold 'help-echo (buffer-file-name)))
" "
;; Spaces 12 - "buffer"
'(:eval
(make-string
(- 12
(min
12
(length (buffer-name))))
?-))
" "
;; Current (row,column)
"(" '(:eval (number-to-string (count-lines 1 (point))))
"," '(:eval (number-to-string (current-column)))
") "
;; Spaces 7 - "(r,c)"
'(:eval
(make-string
(- 7
(min
4
(length (number-to-string (current-column)))
)
(min
3
(length (number-to-string (1+ (count-lines 1 (point)))))))
?-))
;; Percentage of file traversed (current line/total lines)
" ["
'(:eval (number-to-string (/ (* (1+ (count-lines 1 (point))) 100) (count-lines 1 (point-max)))) )
"%%] "
;; Spaces 3 - %
'(:eval
(make-string
(- 3 (length (number-to-string (/ (* (1+ (count-lines 1 (point))) 100) (count-lines 1 (point-max))))))
?-))
;; Major Mode
" [" '(:eval mode-name) "] "
;; Spaces 16 + (6 - %)
'(:eval
(make-string
(- 22
(min
6
(length mode-name)))
?-))
" ("
;; Time
'(:eval (format-time-string "%H:%M"))
;; Fill with '-'
") %-"
))
提前致谢