论坛里有一个16年的帖子问了这个问题,没有解决。
最近更新了emacs,org-capture弹出的buffer总是在右侧,会暂时覆盖原来的buffer。怎么控制它显示在下面的minibuffer里?
论坛里有一个16年的帖子问了这个问题,没有解决。
最近更新了emacs,org-capture弹出的buffer总是在右侧,会暂时覆盖原来的buffer。怎么控制它显示在下面的minibuffer里?
可以用这个插件 GitHub - karthink/popper: Emacs minor-mode to summon and dismiss buffers easily. 将 Org Select 这个 buffer 加入到列表中即可。
这样即使全屏情况下,也都是在下方弹出。如果我用 org-capture, frame 窄的时候新 window 开在下面, frame 宽的时候 window 开在右侧, 并且不会覆盖原来的 buffer.
多窄算窄? 这个值由 split-window-threshold 控制
(use-package popper
    :ensure t ; or :straight t
    :bind (("C-`"   . popper-toggle-latest)
           ("M-`"   . popper-cycle)
           ("C-M-`" . popper-toggle-type))
    :init
    (setq popper-reference-buffers
          '("\\*Messages\\*"
            "Output\\*$"
            "\\*Async Shell Command\\*"
            "\\*Org Select\\*"
            ))
    (popper-mode +1)
    (popper-echo-mode +1))                ; For echo area hints
加了,没变化。看github演示是弹在底部的,我这个还是没变化。
另外: Org Select buffer的弹出位置没法通过split-wieth-threshold控制。
这个是split-width-threshold变量的文档。
split-width-threshold is a variable defined in ‘window.el’.
Its value is nil
Original value was 160
Minimum width for splitting windows sensibly.
If this is an integer, ‘split-window-sensibly’ may split a window
horizontally only if it has at least this many columns.  If this
is nil, ‘split-window-sensibly’ is not allowed to split a window
horizontally.
原始值160,split-window-sensibly函数会split-window-horizontally(split-window-right),我设置为nil就可以在下方弹出了split-window-vertically(split-window-below)。
我用的是 display-buffer-alist,不用装外部的包:
(add-to-list 'display-buffer-alist
   '("CAPTURE"
      (display-buffer-in-side-window)
      (window-height . 0.4)
      (side . bottom)))
控制org capture弹出的org select 和 capture 这两个buffer的大小和位置有以下三种解决方案。
配置display-buffer-alist变量,可同时控制两个buffer的位置和大小,无需安装插件。配置如下:
(add-to-list 'display-buffer-alist
               '("*Org Select*"
                 (display-buffer-in-side-window)
                 (window-height . 0.4)
                 (side . bottom))
               '("CAPTURE-*"
                 (display-buffer-in-side-window)
                 (window-height . 0.4)
                 (side . bottom)))
可以让Org Select和Capture buffer都弹出在bottom。
配置display-buffer-alist变量控制org select buffer位置,配置split-width-threshold变量控制capture buffer位置(但不能控制其大小)
;; 控制 org select buffer
(add-to-list 'display-buffer-alist
               '("*Org Select*"
                 (display-buffer-in-side-window)
                 (window-height . 0.4)
                 (side . bottom)))
;; 控制 org capture buffer
(setq split-width-threshold nil)
安装popper插件,可控制两个buffer的位置,大小无法控制,配置代码如下:
(use-package popper
    :ensure t ; or :straight t
    :bind (("C-`"   . popper-toggle-latest)
           ("M-`"   . popper-cycle)
           ("C-M-`" . popper-toggle-type))
    :init
    (setq popper-reference-buffers
          '(("\\*Org Select\\*" org-mode)
            ("CAPTURE" org-mode)
            ))
    (popper-mode +1)
    (popper-echo-mode +1))
我用的第二种方案。第一个方案里的condition我试了下写combined condition不起作用,只好分别写了两段代码。
(setup popper
  (:global "C-`"   popper-toggle-latest
           "M-`"   popper-cycle
           "C-M-`" popper-toggle-type)
  (:option popper-reference-buffers
           '(("\\*Messages\\*"
             "Output\\*$"
             "\\*Async Shell Command\\*"
             help-mode
              compilation-mode)
             ("\\*Org Select\\*$" org-mode))
           )
  (popper-mode +1)
  (popper-echo-mode +1))
这个也能解决。