emacs - 用于注册的 Windows 配置

标签 emacs

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

    相关文章:

    css - 在 emacs 中缩进 CSS

    emacs - 通过编辑创建目录

    尝试通过 sshfs 保存文件时 emacs 发出警告

    emacs - 使用 nrepl.el 时如何更新 Clojure 依赖项?

    emacs - 您如何确保关联列表在 Emacs 中维护唯一键

    emacs - ess 不会完全安装 ubuntu 12.04

    r - ESS/Emacs 中长时间运行的远程 R session 的状态如何?

    emacs - 删除窗口的更智能替代方案?

    emacs - 如何结合获胜者和工作组?

    emacs - 如何使用 emacs 缩进一个 block ?