5

通过使用这个常见的 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)

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

4

2 回答 2

4

Try using your code in combination with dired-single, which will cause all dired navigation to happen within a single buffer named *dired*. In the interests of full disclosure, I wrote dired-single.

于 2010-11-25T14:30:13.840 回答
3

set-window-dedicated-p强制 Emacs 只显示该缓冲区的窗口,其他 dired 缓冲区不能使用相同的窗口。请参阅*info* 页面了解set-window-dedicated-p

`display-buffer' (*note 选择窗口::) 从不使用专用窗口来显示其中的另一个缓冲区。

也许DiredReuseDirectoryBuffer wiki 页面上的软件包之一提供了您正在寻找的功能......

于 2010-11-22T13:25:28.053 回答