如何使*缓冲区列表*出现在其他窗口下方?

时间:2014-02-05 23:52:11

标签: emacs

那么,不是在当前活动窗口的下方(或右侧)创建一个分割窗口,它会出现在所有已存在的窗口高度的一半之下?并且,在关闭之后,框架布局将在调用C-x C-b之前恢复?

我想查看已打开文件的完整路径。

1 个答案:

答案 0 :(得分:1)

另请参阅我之前对您相关问题的回答:https://stackoverflow.com/a/21544307/2112489

另请参阅@phils的相关答案,其中包含一个不错的halve-other-window-height函数:https://stackoverflow.com/a/4988206/2112489

另请参阅最新版本的Emacs Trunk中提供的内置库存函数display-buffer-below-selecteddisplay-buffer-at-bottom - 我不确定每个函数何时首次引入。他们在window.el

函数split-window的doc-string在相关部分中指出: SIZE默认为一半 WINDOW的大小。这是第二个可选参数 - 即split-window (&optional window size side pixelwise)

不要羞于修改这些东西 - 你可以让它做你想做的任何事情。如果要在显示窗口后自动选择窗口,则可以将其添加到lawlist-display-buffer-below函数的底部:(select-window (get-buffer-window (buffer-name buffer))) - 当然,左边有两个右括号 - 即,let绑定的一个右括号和defun的一个右括号。

(defun lawlist-list-buffers-below (&optional arg)
  "Display a list of existing buffers.
The list is displayed in a buffer named \"*Buffer List*\".
See `buffer-menu' for a description of the Buffer Menu.
    By default, all buffers are listed except those whose names start
with a space (which are for internal use).  With prefix argument
ARG, show only buffers that are visiting files."
  (interactive "P")
  (lawlist-display-buffer-below (list-buffers-noselect arg) nil))

(defun lawlist-display-buffer-below (buffer alist)
 (let (
    (window
      (cond
        ((get-buffer-window buffer (selected-frame)))
        ((window-in-direction 'below))
        (t
          (split-window (selected-window) nil 'below)))))
  (window--display-buffer buffer window 'window alist display-buffer-mark-dedicated)))