2

I have been wondering for a very long time now: how to get a dedicated misc buffer in Emacs?

Auto-completion, function descriptions and perhaps documentation all can go there without ending up somewhere unexpected, but instead at a predefined location (a quarter of the screen perhaps?).

PascalVKooten
  • 20,643
  • 17
  • 103
  • 160

2 Answers2

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.

Community
  • 1
  • 1
shosti
  • 7,332
  • 4
  • 37
  • 42
1

Here is what I do in One On One, to define a dedicated *Help* frame:

;; *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))

You don't need all of those details (pointer shapes etc.), but that gives you the idea. The main thing is to put *Help* on special-display-buffer-names. That's really all you need to do.

The 1on1-* variables used for the frame parameters here are pretty obvious. The *-remove-if function is a standard remove-if. The complete code is here: oneonone.el.

Drew
  • 29,895
  • 7
  • 74
  • 104