unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tak Kunihiro <homeros.misasa@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 35487@debbugs.gnu.org, Tak Kunihiro <homeros.misasa@gmail.com>,
	tkk@misasa.okayama-u.ac.jp, Juri Linkov <juri@linkov.net>
Subject: bug#35487: Make visiting function from help-mode more customizable
Date: Fri, 17 May 2019 19:03:10 +0900	[thread overview]
Message-ID: <m136ldl7oh.fsf@misasa.okayama-u.ac.jp> (raw)
In-Reply-To: <jwvy336duce.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 16 May 2019 16:25:11 -0400")

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





  reply	other threads:[~2019-05-17 10:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-29 12:30 bug#35487: Make visiting function from help-mode more customizable Tak Kunihiro
2019-04-29 19:54 ` Juri Linkov
2019-05-09 23:10   ` Tak Kunihiro
2019-05-10  8:00     ` martin rudalics
2019-05-11 20:42       ` Juri Linkov
2019-05-16  8:52       ` Tak Kunihiro
2019-05-16 20:25         ` Stefan Monnier
2019-05-17 10:03           ` Tak Kunihiro [this message]
2019-05-28 21:09         ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m136ldl7oh.fsf@misasa.okayama-u.ac.jp \
    --to=homeros.misasa@gmail.com \
    --cc=35487@debbugs.gnu.org \
    --cc=juri@linkov.net \
    --cc=monnier@iro.umontreal.ca \
    --cc=tkk@misasa.okayama-u.ac.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).