Emacs中针对dired模式的专用窗口?

Par*_*ult 5 emacs elisp dired

我通过使用这个常见的elisp来让emacs或多或少地表达我的想法:

(defun toggle-current-window-dedication ()
 (interactive)
 (let* ((window    (selected-window))
        (dedicated (window-dedicated-p window)))
   (set-window-dedicated-p window (not dedicated))
   (message "Window %sdedicated to %s"
            (if dedicated "no longer " "")
            (buffer-name))))

(global-set-key [pause] 'toggle-current-window-dedication)
Run Code Online (Sandbox Code Playgroud)

不幸的是,dired使用目录作为缓冲区名称,因此专用dired窗口只将它专用于该目录.向上或向下导航后,它会在单独的窗口中打开一个新缓冲区.我想要做的是将一个窗口专用于主要模式(在这种情况下为dired),并且默认为该模式的所有新缓冲区都更喜欢该窗口.这可能吗?

Joe*_*nte 4

尝试将您的代码与 结合使用dired-single,这将导致所有定向导航发生在名为 的单个缓冲区内*dired*。为了充分披露,我写了dired-single