gpt4 book ai didi

emacs - 我可以更改emacs第一栏的概念吗? (从零到一)

转载 作者:行者123 更新时间:2023-12-04 10:01:46 24 4
gpt4 key购买 nike

Emacs column-number-mode数字列从0开始,这通常不会给我带来任何麻烦,但是我正在使用一些基于行/列的数据文件,其规范以'1'开头,如果我这样做会更容易可以让emacs做到这一点,或者找到一些elisp。

欢迎思想。

最佳答案

您不能轻易地将Emacs更改为具有基于1的列计数,更改必须在C代码中进行。

但是,您可以计算自己的列并将其放在模式行中。注意:这需要使用force-mode-line-update-可能会减慢Emacs的速度(请记住这一点,以防两年后Emacs在某些较大的缓冲区上感觉迟钝)。

;; update the mode line to have line number and column number
(setq mode-line-position
'("%p (%l," (:eval (format "%d)" (1+ (current-column))))))
;; force the update of the mode line so the column gets updated
(add-hook 'post-command-hook 'force-mode-line-update)

使用的文档链接为 'Variables Used In Mode Line''Cursor Position Information'

关于emacs - 我可以更改emacs第一栏的概念吗? (从零到一),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7824145/

24 4 0