Subject: bug#19012: 25.0.50; `help-window-select'

From: Drew Adams <[email-masked]>
Date: Tue, 11 Nov 2014 06:26:08 -0800 (PST)

> Who creates the *Help* buffer and who calls `display-buffer' in the
> case at hand?

The usual displayers of *Help*: `C-h f', `C-h v', `C-h m', `C-h b',
...  And those do generally use `with-help-window'.

But as I mentioned, `display-buffer' in this case uses the logic
of `special-display':

(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))))

(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))
    ^^^^^^^^^^^^^

>  > but it's not obvious to me.  How is a user supposed to know
>  > whether this option applies, i.e., whether "the help window
>  > was created by `with-help-window'?
> 
> By trial and error, I suppose... [When] the help window
> gets selected in some unintuitive way they can tune the behavior
> using this option.

OK.  It doesn't seem to work in the case I presented: *Help* shown
in a dedicated window in a separate frame.

>  > say, for value `other', that "if the help window is alone in
>  > its frame then it is selected".
> 
> I'll do that.

Thanks.

> Indeed.  It would be a bug if it didn't get selected.

That was my hope.  It does not get selected, even with an option
value of `t'.