2

我一直想知道很长一段时间:如何在 Emacs 中获得专用的 misc 缓冲区

自动完成、功能描述和可能的文档都可以到达那里,而不会出现在意想不到的地方,而是在预定义的位置(也许是屏幕的四分之一?)。

4

2 回答 2

2

(I'm assuming you mean a dedicated window instead of a dedicated buffer.) If you keep a window open without doing any other window-splitting commands, help/repl buffers will automatically use it. You can change the size of the window as described in this question.

If you want to do be able to do normal window manipulation but have help windows be a certain size, I suggest you investigate temp-buffer-show-hook, a hook that is run when temporary buffers (such as help buffers) are shown. I haven't tried it, but it would probably be possible to set it to a function that arranges your window configuration in a particular way.

于 2013-08-17T22:56:52.053 回答
1

这是我在 中所做的One On One,用于定义专用*Help*框架:

;; *Help* frame
(if 1on1-*Help*-frame-flag
    (add-to-list
     'special-display-buffer-names
     (list "*Help*" '1on1-display-*Help*-frame
           (list (cons 'background-color 1on1-help-frame-background)
                 (cons 'mouse-color 1on1-help-frame-mouse+cursor-color)
                 (cons 'cursor-color 1on1-help-frame-mouse+cursor-color)
                 '(height . 40))))
  (setq special-display-buffer-names
        (1on1-remove-if (lambda (elt) (equal "*Help*" (car elt)))
                        special-display-buffer-names)))

(defun 1on1-display-*Help*-frame (buf &optional args)
  "Display *Help* buffer in its own frame.
`special-display-function' is used to do the actual displaying.
BUF and ARGS are the arguments to `special-display-function'."
  (let ((old-ptr-shape (and (boundp 'x-pointer-shape) x-pointer-shape))
        return-window)
    (when (boundp 'x-pointer-xterm) (setq x-pointer-shape x-pointer-xterm))
    (setq return-window (select-window (funcall special-display-function buf args)))
    (raise-frame)
    (setq x-pointer-shape old-ptr-shape)
    return-window))

您不需要所有这些细节(指针形状等),但这给了您想法。最主要的是穿上*Help*special-display-buffer-names这就是你真正需要做的。

1on1-*这里用于帧参数的变量非常明显。*-remove-if功能是标准的remove-if。完整的代码在这里:oneonone.el

于 2013-08-17T23:51:55.597 回答