gpt4 book ai didi

emacs - 用于注册的 Windows 配置

转载 作者:行者123 更新时间:2023-12-05 00:04:25 24 4
gpt4 key购买 nike

我开始大量使用命令 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/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com