emacs查看变量当前值的2个办法

emacs的函数和配置根据探测变量的值,而有不同的行为。所以当前变量的值到底是什么很重要。

1、用 default-value 函数。如 C-k 删除行的命令会检测变量 kill-whole-line 的值是 t,则删除整行包含换行符,若为 nil 则删除整行但不含换行符。

(default-value kill-whole-line)

2、直接用 C-h v 查看环境变量。在弹出的窗口会告诉你这个变量的值到底是啥。如执行命令 C-h v kill-whole-line

kill-whole-line is a variable defined in ‘simple.el’.

Its value is nil  ;;这里显示值是nil

If non-nil, ‘kill-line’ with no arg at start of line kills the whole line.
This variable also affects ‘kill-visual-line’ in the same way as
it does ‘kill-line’.

 若把这个值修改为 t,命令 (setq kill-whole-line t) 在执行 C-h v kill-whole-line

kill-whole-line is a variable defined in ‘simple.el’.

Its value is t   ;;现在的值
Original value was nil   ;;原始默认的值,太贴心了emacs

If non-nil, ‘kill-line’ with no arg at start of line kills the whole line.
This variable also affects ‘kill-visual-line’ in the same way as
it does ‘kill-line’.

 

posted @ 2022-04-26 11:31  立体风  阅读(368)  评论(0编辑  收藏  举报