【问题标题】:How to make *Buffer List* appear below the other windows?如何使 *Buffer List* 出现在其他窗口下方?
【发布时间】:2014-02-05 23:52:10
【问题描述】:

那么,与其在当前活动窗口的下方(或右侧)创建一个拆分窗口,不如在所有现有窗口的下方显示一半的框架高度?而且,关闭后,框架布局会恢复到调用C-x C-b之前的样子吗?

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

【问题讨论】:

    标签: emacs


    【解决方案1】:

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

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

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

    函数split-window 的文档字符串在相关部分声明:SIZE 默认为一半 窗口的大小。这是第二个可选参数——即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)))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-27
      • 2013-01-11
      • 2012-01-15
      • 1970-01-01
      • 1970-01-01
      • 2021-08-08
      相关资源
      最近更新 更多