我开始大量使用命令 Cx rw 和 Cx rj 将窗口配置存储到寄存器并在以后调用它们,但是我发现光标位置是按照窗口配置的时间存储的,这有点烦人保存。
基本上我希望光标位置不被存储(或自动更新),这样每当我“跳转”到存储的窗口配置时,我都会获得与上次访问时相同的 View ,而不是我创建它时的 View 。
有任何想法吗?
天使
最佳答案
我也发现这很烦人,只是编写了一个解决方案。使用正常功能(当前窗口配置或窗口配置到注册)存储窗口配置。然后,在应用保存的窗口配置(或注册)之前,
下面的代码就是这样做的。不过,您必须自己将 restore-window-configuration 连接到注册代码。
(defun buffer-point-map ()
(save-excursion
(mapcar (lambda (buffer) (cons (buffer-name buffer)
(progn (set-buffer buffer) (point))))
(buffer-list))))
(defun apply-buffer-points (buff-point-map)
(mapc (lambda (window) (let* ((buffer (window-buffer window))
(buffer-point (cdr (assoc (buffer-name buffer) buff-point-map))))
(when buffer-point (set-window-point window buffer-point))))
(window-list))
nil)
(defun restore-window-configuration (window-config)
(let ((points (buffer-point-map)))
(set-window-configuration window-config)
(apply-buffer-points points)))
关于emacs - 用于注册的 Windows 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5830494/