[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#35487: Make visiting function from help-mode more customizable
From: |
Tak Kunihiro |
Subject: |
bug#35487: Make visiting function from help-mode more customizable |
Date: |
Fri, 17 May 2019 19:03:10 +0900 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (darwin) |
>> (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.
Thank you Stefan for the help!
I think that following will open the code in the same window. I
wanted this for a long time...
#+begin_src emacs-lisp
(define-key help-mode-map (kbd "f") 'push-button-display-same-window)
(define-key help-mode-map (kbd "o") 'push-button)
(defun push-button-display-same-window ()
(interactive)
(let ((display-buffer-overriding-action '(display-buffer-same-window)))
(push-button)))
#+end_src