[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#35487: Make visiting function from help-mode more customizable
From: |
Stefan Monnier |
Subject: |
bug#35487: Make visiting function from help-mode more customizable |
Date: |
Thu, 16 May 2019 16:25:11 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> (define-key help-mode-map (kbd "f") 'push-button-display-buffer)
>
> (defun push-button-display-buffer (&optional action)
> (interactive)
> (or action (setq action 'display-buffer-same-window))
> (let ((display-buffer-alist
> `((display-buffer-condition-from-help ,action))))
> (push-button)))
>
> (defun display-buffer-condition-from-help (_buffer-name _action)
> (with-current-buffer (window-buffer)
> (eq major-mode 'help-mode)))
I think the display-buffer-condition-from-help (which likely should
have a final "-p" in its name) is only needed you you want to add it to
the global value of display-buffer-alist.
In the above code, since you're using a specific binding in
help-mode-map, you presumably already know that (eq major-mode 'help-mode)
so you can just rebind display-buffer-overriding-action.
BTW, this is a case where you could use the same approach as used in the
`other-frame-window` package but using a prefix command which says "use
the same window for the next command".
Stefan