From unknown Mon Jun 23 23:54:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35487: Make visiting function from help-mode more customizable Resent-From: Tak Kunihiro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Apr 2019 12:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 35487 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 35487@debbugs.gnu.org Cc: tkk@misasa.okayama-u.ac.jp X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15565410454394 (code B ref -1); Mon, 29 Apr 2019 12:31:02 +0000 Received: (at submit) by debbugs.gnu.org; 29 Apr 2019 12:30:45 +0000 Received: from localhost ([127.0.0.1]:38580 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hL5Qi-00018o-Lf for submit@debbugs.gnu.org; Mon, 29 Apr 2019 08:30:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59183) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hL5Qh-00018a-1Q for submit@debbugs.gnu.org; Mon, 29 Apr 2019 08:30:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:55537) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hL5Qb-0008UT-3R for submit@debbugs.gnu.org; Mon, 29 Apr 2019 08:30:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hL5QZ-0002a8-R3 for bug-gnu-emacs@gnu.org; Mon, 29 Apr 2019 08:30:36 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hL5QY-0008R0-KN for bug-gnu-emacs@gnu.org; Mon, 29 Apr 2019 08:30:35 -0400 Received: from mlsec.cc.okayama-u.ac.jp ([42.127.236.175]:34214) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hL5QW-0008Gx-O2 for bug-gnu-emacs@gnu.org; Mon, 29 Apr 2019 08:30:34 -0400 Received: from alml002.ouadm.okayama-u.ac.jp (unknown [42.127.236.168]) by mlsec.cc.okayama-u.ac.jp with smtp id 3aba_b6bd_50bf60fd_adcf_4a20_acd2_458995c877f6; Mon, 29 Apr 2019 21:30:20 +0900 Received: from localhost (p282048-ipngn200211tottori.tottori.ocn.ne.jp [114.151.88.48]) by alml002.ouadm.okayama-u.ac.jp (Postfix) with ESMTPSA id 663BE4C09A8; Mon, 29 Apr 2019 21:30:12 +0900 (JST) Date: Mon, 29 Apr 2019 21:30:14 +0900 (JST) Message-Id: <20190429.213014.526232842075202623.tkk@misasa.okayama-u.ac.jp> From: Tak Kunihiro X-Mailer: Mew version 6.8 on Emacs 26.2 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-NAI-Spam-Flag: NO X-NAI-Spam-Level: ********** X-NAI-Spam-Threshold: 11 X-NAI-Spam-Score: 10.1 X-NAI-Spam-Rules: 6 Rules triggered TS_MSG_REP_80_512=10, RCVD_BAD_SIP=0.1, EDT_SA_AU_PASS=0, EDT_SA_DN_PASS=0, EDT_SA_TS_FAIL=0, RV6534=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6534> : inlines <7062> : streams <1820067> : uri <2838474> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 42.127.236.175 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -1.6 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) * Message I often want to visit function from help-mode in `this window' in stead of `other window'. To do so, I found that to revise help-function in help-function-def works. I propose to (1) move help-function described as lambda function out of button definition and (2) make function to visit function from help-mode customizable. After the revision, I can visit function from help-mode in `this windows' as shown below. #+begin_src emacs-lisp (define-key help-mode-map (kbd "f") (lambda () (interactive) (let ((help-switch-buffer-function 'switch-to-buffer)) (push-button)))) #+end_src I attach commit log and patch. * Commit log Author: Tak Kunihiro Make visiting function from help-mode more customizable * lisp/help-mode.el (define-button-type): Move definition of help-function out. (help-switch-buffer-function): Function to display buffer in help-mode. (help-find-function): Define help-function using a new variable `help-switch-buffer-function'. * Patch diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 6cc3f0d4f7..4e01e73181 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -192,32 +192,39 @@ 'help-customize-face (define-button-type 'help-function-def :supertype 'help-xref - 'help-function (lambda (fun &optional file type) - (or file - (setq file (find-lisp-object-file-name fun type))) - (if (not file) - (message "Unable to find defining file") - (require 'find-func) - (when (eq file 'C-source) - (setq file - (help-C-file-name (indirect-function fun) 'fun))) - ;; Don't use find-function-noselect because it follows - ;; aliases (which fails for built-in functions). - (let* ((location - (find-function-search-for-symbol fun type file)) - (position (cdr location))) - (pop-to-buffer (car location)) - (run-hooks 'find-function-after-hook) - (if position - (progn - ;; Widen the buffer if necessary to go to this position. - (when (or (< position (point-min)) - (> position (point-max))) - (widen)) - (goto-char position)) - (message "Unable to find location in file"))))) + 'help-function 'help-find-function 'help-echo (purecopy "mouse-2, RET: find function's definition")) +(defvar help-switch-buffer-function 'pop-to-buffer + "Function to display buffer in help-mode.") + +(defun help-find-function (fun &optional file type) + "Find object shown in help-mode." + (or file + (setq file (find-lisp-object-file-name fun type))) + (if (not file) + (message "Unable to find defining file") + (require 'find-func) + (when (eq file 'C-source) + (setq file + (help-C-file-name (indirect-function fun) 'fun))) + ;; Don't use find-function-noselect because it follows + ;; aliases (which fails for built-in functions). + (let* ((location + (find-function-search-for-symbol fun type file)) + (position (cdr location))) + ;; (pop-to-buffer (car location)) + (funcall help-switch-buffer-function (car location)) + (run-hooks 'find-function-after-hook) + (if position + (progn + ;; Widen the buffer if necessary to go to this position. + (when (or (< position (point-min)) + (> position (point-max))) + (widen)) + (goto-char position)) + (message "Unable to find location in file"))))) + (define-button-type 'help-function-cmacro ; FIXME: Obsolete since 24.4. :supertype 'help-xref 'help-function (lambda (fun file) From unknown Mon Jun 23 23:54:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35487: Make visiting function from help-mode more customizable Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Apr 2019 20:21:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35487 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tak Kunihiro Cc: 35487@debbugs.gnu.org Received: via spool by 35487-submit@debbugs.gnu.org id=B35487.15565692292817 (code B ref 35487); Mon, 29 Apr 2019 20:21:03 +0000 Received: (at 35487) by debbugs.gnu.org; 29 Apr 2019 20:20:29 +0000 Received: from localhost ([127.0.0.1]:39884 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hLClI-0000jN-GW for submit@debbugs.gnu.org; Mon, 29 Apr 2019 16:20:28 -0400 Received: from bird.maple.relay.mailchannels.net ([23.83.214.17]:61968) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hLClE-0000jB-H1 for 35487@debbugs.gnu.org; Mon, 29 Apr 2019 16:20:25 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 6CAD03E602F; Mon, 29 Apr 2019 20:20:23 +0000 (UTC) Received: from pdx1-sub0-mail-a39.g.dreamhost.com (unknown [100.96.28.64]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id CE7BF3E5FDE; Mon, 29 Apr 2019 20:20:22 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from pdx1-sub0-mail-a39.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.2); Mon, 29 Apr 2019 20:20:23 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Reaction-Fumbling: 61f45eb700fa774a_1556569222972_2302656892 X-MC-Loop-Signature: 1556569222972:2424465484 X-MC-Ingress-Time: 1556569222972 Received: from pdx1-sub0-mail-a39.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a39.g.dreamhost.com (Postfix) with ESMTP id 57A5682B5D; Mon, 29 Apr 2019 13:20:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=2NBsvNGDCGmt2o/VT4Gc37sRrHw=; b= EZ/QfCXZD70Lzlwh2MuT7WNE9lim0+LeVOFsOPcT0IdyZmMx5QvKpkz7pMb2Zzau pGA+uV/YLNI3sqbRE0eYDpvKs4Z83hqpkors0HrQA9AHRn5HUDLg1jdVcJsP/2/U VlMSmRXWynVcTKprauSSxXM4DnjvPsWzd/zFg//JJ6w= Received: from mail.jurta.org (m91-129-107-198.cust.tele2.ee [91.129.107.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a39.g.dreamhost.com (Postfix) with ESMTPSA id 602E182B64; Mon, 29 Apr 2019 13:20:18 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a39 From: Juri Linkov Organization: LINKOV.NET References: <20190429.213014.526232842075202623.tkk@misasa.okayama-u.ac.jp> Date: Mon, 29 Apr 2019 22:54:34 +0300 In-Reply-To: <20190429.213014.526232842075202623.tkk@misasa.okayama-u.ac.jp> (Tak Kunihiro's message of "Mon, 29 Apr 2019 21:30:14 +0900 (JST)") Message-ID: <87sgu0wps5.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddriedvgdduhedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddtjedrudelkeenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrddutdejrdduleekpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepthhkkhesmhhishgrshgrrdhokhgrhigrmhgrqdhurdgrtgdrjhhpnecuvehluhhsthgvrhfuihiivgeptd X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > I often want to visit function from help-mode in `this window' in > stead of `other window'. To do so, I found that to revise > help-function in help-function-def works. > > I propose to (1) move help-function described as lambda function out > of button definition and (2) make function to visit function from > help-mode customizable. > > After the revision, I can visit function from help-mode in `this > windows' as shown below. I have exactly the same problem. Fortunately, we have a powerful customization mechanism of display-buffer-alist to allow clicking a link from the *Help* buffer to open source code in the same window: #+begin_src emacs-lisp (custom-set-variables '(display-buffer-alist '((display-buffer-condition-from-help display-buffer-same-window)))) (defun display-buffer-condition-from-help (_buffer-name _action) (string-match-p "\\`\\*\\(Help\\)\\*\\(\\|<[0-9]+>\\)\\'" (buffer-name (current-buffer)))) #+end_src From unknown Mon Jun 23 23:54:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35487: Make visiting function from help-mode more customizable Resent-From: Tak Kunihiro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 May 2019 23:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35487 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Juri Linkov Cc: 35487@debbugs.gnu.org, tkk@misasa.okayama-u.ac.jp Received: via spool by 35487-submit@debbugs.gnu.org id=B35487.155744342616660 (code B ref 35487); Thu, 09 May 2019 23:11:02 +0000 Received: (at 35487) by debbugs.gnu.org; 9 May 2019 23:10:26 +0000 Received: from localhost ([127.0.0.1]:36678 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hOsBG-0004Kd-E0 for submit@debbugs.gnu.org; Thu, 09 May 2019 19:10:26 -0400 Received: from mail-pf1-f179.google.com ([209.85.210.179]:38141) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hOsBC-0004KM-CE for 35487@debbugs.gnu.org; Thu, 09 May 2019 19:10:24 -0400 Received: by mail-pf1-f179.google.com with SMTP id 10so2099752pfo.5 for <35487@debbugs.gnu.org>; Thu, 09 May 2019 16:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=5c35f8UUZ4OfOWY8roQ3kqCzmop6ATuyo5Z0WzhCW5c=; b=pYseVAsFATHk1H6wxwFoo1P6QdbKZs+pk9IMdlCXS5Q8TJTfdi8MLVomoYUipEC9jM 5c5JBzTLpfze7ekVHMpsA/hf7pWShHmTGK0IzdesepC6Xrd5TJGvCCrGNpFQmYLadX3Z 1Jv0qUld0pmew4a8TT+Kg1ch7dKNKKzD8tddG4e9zTEF8HUwBYPy66z7/JV4khBlTo+l O817BxNhvO+F7TV4IQBGv99sAlkY7mj8eoQARI3nqu2mJuH+mdTKxi8l8ZFDvePcCoS9 ptp1L3/UwXKTGIC2PM4M6fNV70gH/uuykyVll6EnNUjf6GGYmQ4hDyd4n2yw7mPOLJo9 5sEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=5c35f8UUZ4OfOWY8roQ3kqCzmop6ATuyo5Z0WzhCW5c=; b=hmTlsiZy6dtg9ZunUia/pN9/XsGjUl74uCdLmfvPnf6RPIV3UD16wj7SUS92EVqCmK cHz1aM+xTUQX2iS1S9i23Y7phJOWXNOe+TOIBMDYuxT6TdFfbyz/iicsZlHkYINaElA7 H5JJkLhwq2dGMcc6C3ZwKUNldiLaZ0dcpc7NBsv4wxyTg81BnIL93Kqdgx7e0b/X9I7E TNWU23p0sFDKDjAmk/nuQFu/nk2DVQBGOYZLMhj4lQTfUZCivOsxc88mwQB+UcBPI2km dP4AE49aIS0SDkFTfC5vHJIfv+y7T0vOqy0rpmw/kkPBP4KH/ZLpAAJRkO12vDiscyss QBDA== X-Gm-Message-State: APjAAAUkXvYZlulg+XT87eU3qMNKMK6Zrcfl0BeRpj6YKUsKen+15eb5 G49uZ7xZ3WEb070MylauNxdu8f6/ X-Google-Smtp-Source: APXvYqwlo0Pa56ii2WbaDojeXNI3Gz29+G4u8YATXEqqQJmhnv/5XWNlYPkEuxKJh/egOXCm+vcZ+Q== X-Received: by 2002:a62:cfc4:: with SMTP id b187mr9464826pfg.134.1557443415702; Thu, 09 May 2019 16:10:15 -0700 (PDT) Received: from thinkless2017 (vesta.misasa.okayama-u.ac.jp. [150.46.48.154]) by smtp.gmail.com with ESMTPSA id d3sm4156821pfn.113.2019.05.09.16.10.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 May 2019 16:10:15 -0700 (PDT) From: Tak Kunihiro X-Google-Original-From: Tak Kunihiro References: <20190429.213014.526232842075202623.tkk@misasa.okayama-u.ac.jp> <87sgu0wps5.fsf@mail.linkov.net> Date: Fri, 10 May 2019 08:10:13 +0900 In-Reply-To: <87sgu0wps5.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 29 Apr 2019 22:54:34 +0300") Message-ID: <8636lnp6lm.fsf@misasa.okayama-u.ac.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (windows-nt) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Juri Linkov writes: >> I often want to visit function from help-mode in `this window' in >> stead of `other window'. To do so, I found that to revise >> help-function in help-function-def works. >> >> I propose to (1) move help-function described as lambda function out >> of button definition and (2) make function to visit function from >> help-mode customizable. >> >> After the revision, I can visit function from help-mode in `this >> windows' as shown below. > > I have exactly the same problem. Fortunately, we have a powerful > customization mechanism of display-buffer-alist to allow clicking > a link from the *Help* buffer to open source code in the same window: > > #+begin_src emacs-lisp > (custom-set-variables > '(display-buffer-alist > '((display-buffer-condition-from-help display-buffer-same-window)))) > > (defun display-buffer-condition-from-help (_buffer-name _action) > (string-match-p "\\`\\*\\(Help\\)\\*\\(\\|<[0-9]+>\\)\\'" (buffer-name (current-buffer)))) > #+end_src Thank you for the solution! Now from *Help* buffer I can open source code in the same window by mouse click. As a side effect, `C-h f' opens *Help* buffer in the same window. I still want to open *Help* in other window (original behavior). Do you have idea to do so? From unknown Mon Jun 23 23:54:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35487: Make visiting function from help-mode more customizable Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 May 2019 08:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35487 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tak Kunihiro , Juri Linkov Cc: 35487@debbugs.gnu.org, tkk@misasa.okayama-u.ac.jp Received: via spool by 35487-submit@debbugs.gnu.org id=B35487.15574752469304 (code B ref 35487); Fri, 10 May 2019 08:01:02 +0000 Received: (at 35487) by debbugs.gnu.org; 10 May 2019 08:00:46 +0000 Received: from localhost ([127.0.0.1]:37032 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hP0SU-0002Pz-Li for submit@debbugs.gnu.org; Fri, 10 May 2019 04:00:46 -0400 Received: from mout.gmx.net ([212.227.15.19]:52841) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hP0SS-0002Pn-OH for 35487@debbugs.gnu.org; Fri, 10 May 2019 04:00:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1557475228; bh=7MpBZdCAofdOeSG8RBrG/TuBJGT2zY5KrOonuxkPoK0=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=I1GJhIzTVeqPTuEm2kT0szFp28L05B67uB6jOREBq9p5O1PCeo6zc0k+KB5Gfl52Z f+oF5DFuzwzOA50U1KAc32DVcjm3DV9ndHbN69Q7MT66hrv7F/qiu3tTbv93T+f0xz PraD0DhTGNa/KkDEPhUWJiWzmT79VgR+uHVm3Tak= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.101] ([212.95.5.202]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LcSAg-1gy9d416da-00jseD; Fri, 10 May 2019 10:00:28 +0200 References: <20190429.213014.526232842075202623.tkk@misasa.okayama-u.ac.jp> <87sgu0wps5.fsf@mail.linkov.net> <8636lnp6lm.fsf@misasa.okayama-u.ac.jp> From: martin rudalics Message-ID: Date: Fri, 10 May 2019 10:00:30 +0200 MIME-Version: 1.0 In-Reply-To: <8636lnp6lm.fsf@misasa.okayama-u.ac.jp> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:U0extri0mzC52sQ+mRwpY9P5shUQfOjb0iBSLe+hxCq0xvNaXx+ hREljsOdtG9qKPkZFtO71Cr1tvzqhE8CbVtNBLJdmKjB3oiukCSsHgSOv/LDaxKIhNZA7Wt gxlml3wXHFdEyu/wUihDynvbfiTXPSv6AD2LljQ32odz0xIs2vSYMgygp2NF4Ien+EC2cNj DrDIz7qdghmdnaso0LwLQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:tlSxNXbreb4=:RuOTcc0H4tv2BK/52dvu5o u/Jc3vzm1E9w3M67j2oEOnD7c19fpG6XYiO/bGstuhA5Rl9E/w/Oe6r/sAh0A68mtb2LPpwe6 RKyOGF/+N0L02MQniE7adjKMWXgJtlS2VrL8lKIgHQsnukNk/ZfA6pte5Kt/3bZ4biF3bpg6i rO1qAGYTu6OUTPYjrkOipaW+8CTMUPBzupf0UImtfpS4FVTGLsLHlqZ0gDwEj5xctDwXLKhFw V3oLYIOc0yP09H94vXYWt6JPymw5kTAl2dkcGt+9MeemB/+/lTl8N2oI9cKu/Tljm18Oqyeks xhcAIgORzWp9EY16AM6tGMIvN0fu3wfa3MswEp3+ZaC3I8aIO0vcgIYWUsPLV2BxQ5oHTLKVo s2PZnVr7EkPyvDPRvc92y8IKW5mJVLNna3Hf15UGu8uWS4/5KDTKCBBKkOL3oOKoZ9z2fFyli uNYoN7aJ7Xj2gCL190qPGtgkJGAO11EO1t0HLjz7DY0LjpMb6XdUlGxd/eBryIP2/lKm7wn4X cNhp7ZNeDrcPl3yLBmBhhdHomPuY+fAWu5mwuGSpheeNM2BMIv+0VDw6ydFt7QnZekbNKw3bP f6DpLvG1WncmX8VGlXCkm7OreMYrdEP42HGda7p75fNBTdOszi3/6aCQiJwCxh9KbkGh5l1O5 pSPwVIOcIGP0RgTRk7/wHSuhPHDUfAFbqJnox1UfQEwVFrEA5oRsGRihQATuwQiBVMp3pBzfI K9SoMsYGJxcWv/tVxVy8WUpINlGVjNkd+9IbggRmkLNW2dXsKK0qC11iWvxA2iCm3Qi9pDH4g I8ioNcVALBW8V4nMRJ1wdXu2FPkfaSw1FyeFP2vatw7t9OLRvo0jCQYBkJh8Uoszmm0MVVi/v 6b/xCn3oKadYv4MLfNzZWJnsaah2OPtFpSCD9yMAllev1piMei6HYsbIaruN0/C0UECs+1xfM o3Oe2z0PQ3A== X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > As a side effect, `C-h f' opens *Help* buffer in the same window. I > still want to open *Help* in other window (original behavior). Do you > have idea to do so? You could try with (defun display-buffer-condition-from-help (_buffer-name _action) (string-match-p "\\`\\*\\(Help\\)\\*\\(\\|<[0-9]+>\\)\\'" (buffer-name (window-buffer)))) martin From unknown Mon Jun 23 23:54:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35487: Make visiting function from help-mode more customizable Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 May 2019 21:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35487 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: martin rudalics Cc: 35487@debbugs.gnu.org, Tak Kunihiro , tkk@misasa.okayama-u.ac.jp Received: via spool by 35487-submit@debbugs.gnu.org id=B35487.155760913022232 (code B ref 35487); Sat, 11 May 2019 21:13:01 +0000 Received: (at 35487) by debbugs.gnu.org; 11 May 2019 21:12:10 +0000 Received: from localhost ([127.0.0.1]:41300 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hPZHu-0005mW-6p for submit@debbugs.gnu.org; Sat, 11 May 2019 17:12:10 -0400 Received: from lavender.maple.relay.mailchannels.net ([23.83.214.99]:21550) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hPZHs-0005mN-4h for 35487@debbugs.gnu.org; Sat, 11 May 2019 17:12:08 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id CFFEC501B2E; Sat, 11 May 2019 21:12:06 +0000 (UTC) Received: from pdx1-sub0-mail-a85.g.dreamhost.com (100-96-30-28.trex.outbound.svc.cluster.local [100.96.30.28]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 2971E501BB3; Sat, 11 May 2019 21:12:06 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from pdx1-sub0-mail-a85.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.2); Sat, 11 May 2019 21:12:06 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Thread-Cooperative: 07a007d5132a1e52_1557609126509_3511733854 X-MC-Loop-Signature: 1557609126509:265847912 X-MC-Ingress-Time: 1557609126509 Received: from pdx1-sub0-mail-a85.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a85.g.dreamhost.com (Postfix) with ESMTP id 2C8738039D; Sat, 11 May 2019 14:12:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=Fyu1BhuyL65CJ2fQ/JWP9JwcrqA=; b= s1dj9lfCtyQxXO+KtDb0tFgKhPKxFhDrseoJJOZzo2q2G8hCZ2T4/91RuVQEbBlV zvrFjvKShoeVyWNor1JN5sDkC+mJ4p9uZUO9R8NgRwZ1o9y+hcIBMrRggBj0Pgmp GW/qou+Hq/OlXbF3V+0gyF7tY4SpyuVqaWW473iQGbc= Received: from mail.jurta.org (m91-129-96-230.cust.tele2.ee [91.129.96.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a85.g.dreamhost.com (Postfix) with ESMTPSA id C75628039A; Sat, 11 May 2019 14:11:56 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a85 From: Juri Linkov Organization: LINKOV.NET References: <20190429.213014.526232842075202623.tkk@misasa.okayama-u.ac.jp> <87sgu0wps5.fsf@mail.linkov.net> <8636lnp6lm.fsf@misasa.okayama-u.ac.jp> Date: Sat, 11 May 2019 23:42:29 +0300 In-Reply-To: (martin rudalics's message of "Fri, 10 May 2019 10:00:30 +0200") Message-ID: <87woiwbu4q.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddrledtgdduiedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrdeliedrvdeftdenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrdeliedrvdeftddprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehruhgurghlihgtshesghhmgidrrghtnecuvehluhhsthgvrhfuihiivgeptd X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >> As a side effect, `C-h f' opens *Help* buffer in the same window. I >> still want to open *Help* in other window (original behavior). Do you >> have idea to do so? > > You could try with > > (defun display-buffer-condition-from-help (_buffer-name _action) > (string-match-p "\\`\\*\\(Help\\)\\*\\(\\|<[0-9]+>\\)\\'" > (buffer-name (window-buffer)))) I confirm this is more correct. BTW, I observed one strange effect: after the *Help* buffer is displayed on one window, the next time it's always displayed in the same window where it was displayed previously: 0. emacs -Q 1. C-h f car RET 2. C-x o 3. C-h i 4. C-h f car RET is displayed in the same window, whereas 5. C-h f cdr RET is displayed in another window From unknown Mon Jun 23 23:54:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35487: Make visiting function from help-mode more customizable Resent-From: Tak Kunihiro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 May 2019 08:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35487 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: martin rudalics Cc: 35487@debbugs.gnu.org, Tak Kunihiro , tkk@misasa.okayama-u.ac.jp, Juri Linkov Received: via spool by 35487-submit@debbugs.gnu.org id=B35487.155799676223539 (code B ref 35487); Thu, 16 May 2019 08:53:01 +0000 Received: (at 35487) by debbugs.gnu.org; 16 May 2019 08:52:42 +0000 Received: from localhost ([127.0.0.1]:54213 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRC82-00067a-9t for submit@debbugs.gnu.org; Thu, 16 May 2019 04:52:42 -0400 Received: from mail-pl1-f182.google.com ([209.85.214.182]:34938) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRC81-00067N-7i for 35487@debbugs.gnu.org; Thu, 16 May 2019 04:52:41 -0400 Received: by mail-pl1-f182.google.com with SMTP id g5so1292833plt.2 for <35487@debbugs.gnu.org>; Thu, 16 May 2019 01:52:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=oOh/G6Y1YSqY+BEH+szS8k8rK36iTyEIuGOIMln9RoM=; b=Nm61nT+Os1EnRYUcdJJp+NvO79J/qUJOz+IIbQ8e8iIoojLo3t+5v6uwd5c/ir78oj /1kFPAEhXB0XN5Am+fEpkv4oIGR/o0/W4Dz4NY2tuNVZRAPXaraEqUtlrpDAMRn90Not rnkd3eEnwg8DPAEgWkx/8KsvkkZ7g61uphSYzzFYqKHorp3UNMYC4ipvt4z7AQdzbMCT aWxEW35baX/5uiXPDcmRMWkmQZEmUxJRhOHwYT5DNyLJMVwK1ILloGY5837CidwmwZkR qBGVljXGWDBmAoW7Xyv7xSYn39F8ttdElDpDOE/MqQXeXbN+egjqlD3/5PtP3EB0t75+ dYkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=oOh/G6Y1YSqY+BEH+szS8k8rK36iTyEIuGOIMln9RoM=; b=gMne4RyxyfjxSClAa+cCAQoROW224iEO2n9oRo2AIVBRtFQYxIfuiiya6Zzr9ALpW4 t2IVUAO7T7yxUxz/CLp3KeQMhgAvxuU4ZP3JLbF9kRtD93YTbA69gjycaT6rLbf8ap4T C6jPEaV/jL2CylfL7OmcDuLp9l15YV7/6rylzF5bcJgvdMeh3tOCIgKfjXpl9foi7AJ9 FGItEruRFQ/LH8THIgn4hNiuZ80RiXQBKnU92eWdr/v5ALjTj9U6hK8IDjktyh0cyT5M Ro4h9CQnwMxJtJ88mQXgu/jg7aMyp1aAUajlTmBmr0kxDBKC23bYsHdENfFuX60aJmBf Vmjw== X-Gm-Message-State: APjAAAXmep70dW19xQ3i7UMPqUlsG6V6lDgrLirijb3YM7rGDozWqVcE qr1oJ5myjkU2Qe26sNGVM4o= X-Google-Smtp-Source: APXvYqy/wTr7sT5IO4LdFTHdbDqLOBBhiVWsvMcz1nkVALsWQTGrx8732gtbJjnpbKP8vAylV96+og== X-Received: by 2002:a17:902:7406:: with SMTP id g6mr47460162pll.328.1557996753814; Thu, 16 May 2019 01:52:33 -0700 (PDT) Received: from thinkless2017 (vesta.misasa.okayama-u.ac.jp. [150.46.48.154]) by smtp.gmail.com with ESMTPSA id o6sm11650124pfa.88.2019.05.16.01.52.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 May 2019 01:52:33 -0700 (PDT) From: Tak Kunihiro X-Google-Original-From: Tak Kunihiro References: <20190429.213014.526232842075202623.tkk@misasa.okayama-u.ac.jp> <87sgu0wps5.fsf@mail.linkov.net> <8636lnp6lm.fsf@misasa.okayama-u.ac.jp> Date: Thu, 16 May 2019 17:52:27 +0900 In-Reply-To: (martin rudalics's message of "Fri, 10 May 2019 10:00:30 +0200") Message-ID: <86zhnmn5mc.fsf@misasa.okayama-u.ac.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (windows-nt) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) I configured `f' in help-mode in following way based on comments and now it works good. Thank you Juri and Martin for the responses! #+begin_src emacs-lisp (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))) #+end_src From unknown Mon Jun 23 23:54:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35487: Make visiting function from help-mode more customizable Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 May 2019 20:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35487 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Tak Kunihiro Cc: 35487@debbugs.gnu.org, martin rudalics , tkk@misasa.okayama-u.ac.jp, Juri Linkov Received: via spool by 35487-submit@debbugs.gnu.org id=B35487.155803832011690 (code B ref 35487); Thu, 16 May 2019 20:26:01 +0000 Received: (at 35487) by debbugs.gnu.org; 16 May 2019 20:25:20 +0000 Received: from localhost ([127.0.0.1]:56562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRMwK-00032T-Ft for submit@debbugs.gnu.org; Thu, 16 May 2019 16:25:20 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:7907) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRMwJ-00032D-9t for 35487@debbugs.gnu.org; Thu, 16 May 2019 16:25:19 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id BE5BE100B97; Thu, 16 May 2019 16:25:13 -0400 (EDT) Received: from mail02.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 7552F1007CC; Thu, 16 May 2019 16:25:12 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1558038312; bh=tP3+oADLq6wsHynLnulLXqKV8ppebVIikl9T8RC3ni8=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=MoI3Qel8Q3SDMg+Hy6GFtZoAoT6Sk6zHB57b2SxVsWfEy/aKAw/G6UHvKdmk4PVb1 2RVgtwOO4TaAnSPJKTTdlMIHOUDcm1XZOX8u0Otn5aCL8vgHgRsmrkm/RQHrQgajLZ WrlaWD7b8MptZQALtZKp9jPN1XCD/1zJscqemJYXaw0sfd5y1LXbtjf0aG+kuRt571 j4jI2cwReEv3GePYsbzpYRZjpET52h5ILSHAPlOfKfoAfJZaBSUWSuxT/mU9PGLsD9 yus6WYvnnL0W84arfa4MF/z8AUdE4eA9+536FoVbXIo+6ATccSzY5xEVQlF15lFxoS YGNcGJ4DuAhtw== Received: from ceviche (modemcable157.163-203-24.mc.videotron.ca [24.203.163.157]) by mail02.iro.umontreal.ca (Postfix) with ESMTPSA id 4D196120893; Thu, 16 May 2019 16:25:12 -0400 (EDT) From: Stefan Monnier Message-ID: References: <20190429.213014.526232842075202623.tkk@misasa.okayama-u.ac.jp> <87sgu0wps5.fsf@mail.linkov.net> <8636lnp6lm.fsf@misasa.okayama-u.ac.jp> <86zhnmn5mc.fsf@misasa.okayama-u.ac.jp> Date: Thu, 16 May 2019 16:25:11 -0400 In-Reply-To: <86zhnmn5mc.fsf@misasa.okayama-u.ac.jp> (Tak Kunihiro's message of "Thu, 16 May 2019 17:52:27 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.639 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > (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 From unknown Mon Jun 23 23:54:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35487: Make visiting function from help-mode more customizable Resent-From: Tak Kunihiro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 May 2019 10:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35487 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Stefan Monnier Cc: 35487@debbugs.gnu.org, martin rudalics , Tak Kunihiro , tkk@misasa.okayama-u.ac.jp, Juri Linkov Received: via spool by 35487-submit@debbugs.gnu.org id=B35487.155808740313197 (code B ref 35487); Fri, 17 May 2019 10:04:01 +0000 Received: (at 35487) by debbugs.gnu.org; 17 May 2019 10:03:23 +0000 Received: from localhost ([127.0.0.1]:57332 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRZhz-0003Qm-28 for submit@debbugs.gnu.org; Fri, 17 May 2019 06:03:23 -0400 Received: from mail-pg1-f175.google.com ([209.85.215.175]:46618) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRZhw-0003QZ-QX for 35487@debbugs.gnu.org; Fri, 17 May 2019 06:03:21 -0400 Received: by mail-pg1-f175.google.com with SMTP id t187so3061426pgb.13 for <35487@debbugs.gnu.org>; Fri, 17 May 2019 03:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=YmPwdcDb7Cj2slgp8c0B/mucBWZtP3uMLWUmbCOdOxY=; b=dvoDvX2raSgmYBoZCSXCVtz+2CiBBFcahNUCuDRLrc6HEnLwkmNNvbvzsXQnqm5smj Iy5c60QOcxnPunA0KOzr9jhvCZagBcrYfmsfJYFWLJmUdKZZ+saH+swneothGlzTDL01 a+1GpkI3vjgGkGCqjr/wRkRVJ24+e3ti5MlmbtSiCYVS7qPUX6o/b98zi3dd7tnP6M24 GR8d2/A94g6btLAjLyGXUiWsgpVCRsvLvLVmLGUYjDwVU3W9LmcBGfZxz5E0VklNBOXq qSyg1L1xfNfXT07PAqdRESPqisbgRWZt9zanIcTqOjCAZB1dF/D8OEAIf8pNj/UjtvsU DSrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=YmPwdcDb7Cj2slgp8c0B/mucBWZtP3uMLWUmbCOdOxY=; b=Sxc9zlXVcNRXD0lyL1WFLL7/s8vlOnijbKekh7yz6pifvYWnmn7T7gi+47gso7yPss i4bH3dSdIymR5C9FG4eDvf4DTgUzKmkTOf2OaLEKkvwmtArXC0JT+F9IuFixwsg+xRWE z5NWV5BiyBARlTq4qNO5J77174o0CSnIYSfFYITPLdzOo9LDCvo5t0Ycbu4J87TC+xAS 9mitJ41pO//ly4LOwPR8cIUkErPOktSGre9t7AZX45B1puLNN8Xr+OyboAUCUuIod/0e /wqGzlO0jL02JomS7Dnn5gGoPL96CDztIqviRP1aoSx6fkvIWqzcBgQSbnJaQcMlYy6U +utA== X-Gm-Message-State: APjAAAWQ7X0BsHIrxwWzndcVf2N7cyJS4UDgnk2dVMCyDqr3zCAONnHQ p9tHHMQSsV7iCEmYE7hMatM= X-Google-Smtp-Source: APXvYqwjofeR4d8e9Kwwv4B4TrGMAxiEr6uYBKwoeSump05FUjgG5kIviD0z9aIRgtsBZGsHVS4FXQ== X-Received: by 2002:a63:5ec5:: with SMTP id s188mr39975145pgb.418.1558087394872; Fri, 17 May 2019 03:03:14 -0700 (PDT) Received: from DreamMini2019.local (vesta.misasa.okayama-u.ac.jp. [150.46.48.154]) by smtp.gmail.com with ESMTPSA id l63sm12142871pfl.181.2019.05.17.03.03.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 17 May 2019 03:03:14 -0700 (PDT) From: Tak Kunihiro X-Google-Original-From: Tak Kunihiro References: <20190429.213014.526232842075202623.tkk@misasa.okayama-u.ac.jp> <87sgu0wps5.fsf@mail.linkov.net> <8636lnp6lm.fsf@misasa.okayama-u.ac.jp> <86zhnmn5mc.fsf@misasa.okayama-u.ac.jp> Date: Fri, 17 May 2019 19:03:10 +0900 In-Reply-To: (Stefan Monnier's message of "Thu, 16 May 2019 16:25:11 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (darwin) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >> (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 From unknown Mon Jun 23 23:54:37 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Tak Kunihiro Subject: bug#35487: closed (Re: bug#35487: Make visiting function from help-mode more customizable) Message-ID: References: <878suqcml5.fsf@mail.linkov.net> <20190429.213014.526232842075202623.tkk@misasa.okayama-u.ac.jp> X-Gnu-PR-Message: they-closed 35487 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 35487@debbugs.gnu.org Date: Tue, 28 May 2019 21:11:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1559077862-26652-1" This is a multi-part message in MIME format... ------------=_1559077862-26652-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #35487: Make visiting function from help-mode more customizable which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 35487@debbugs.gnu.org. --=20 35487: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D35487 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1559077862-26652-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 35487-done) by debbugs.gnu.org; 28 May 2019 21:10:59 +0000 Received: from localhost ([127.0.0.1]:57391 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hVjN4-0006vd-Jg for submit@debbugs.gnu.org; Tue, 28 May 2019 17:10:58 -0400 Received: from quail.birch.relay.mailchannels.net ([23.83.209.151]:36259) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hVjN0-0006vS-1n for 35487-done@debbugs.gnu.org; Tue, 28 May 2019 17:10:54 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id CF57C5E3911; Tue, 28 May 2019 21:10:52 +0000 (UTC) Received: from pdx1-sub0-mail-a6.g.dreamhost.com (100-96-91-66.trex.outbound.svc.cluster.local [100.96.91.66]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 179685E3B78; Tue, 28 May 2019 21:10:52 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from pdx1-sub0-mail-a6.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.2); Tue, 28 May 2019 21:10:52 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Abiding-Left: 66d44ada3e7583a0_1559077852690_3477997690 X-MC-Loop-Signature: 1559077852690:1482799419 X-MC-Ingress-Time: 1559077852690 Received: from pdx1-sub0-mail-a6.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a6.g.dreamhost.com (Postfix) with ESMTP id AEB0680185; Tue, 28 May 2019 14:10:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=U4OV5+lzq2o9j74get2Ry18jwNk=; b= VOWNeAkDxrbWrPAYW5lO7tPmwbtAedmSHkyuJSCRlpwkvWXE19Aj4bop1DeGEM57 XAVJ2gah34ZRQqEPlFldBSAeanQGqWBqJn7POFn8UF5tLybQqW9VPrHF4bV+J+qN c3PLnEmrcNlW+2NQk9xhV9PzSZmTKQ65zLYgGOE8KlY= Received: from mail.jurta.org (m91-129-96-73.cust.tele2.ee [91.129.96.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a6.g.dreamhost.com (Postfix) with ESMTPSA id 0E5CB80199; Tue, 28 May 2019 14:10:42 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a6 From: Juri Linkov To: Tak Kunihiro Subject: Re: bug#35487: Make visiting function from help-mode more customizable Organization: LINKOV.NET References: <20190429.213014.526232842075202623.tkk@misasa.okayama-u.ac.jp> <87sgu0wps5.fsf@mail.linkov.net> <8636lnp6lm.fsf@misasa.okayama-u.ac.jp> <86zhnmn5mc.fsf@misasa.okayama-u.ac.jp> Date: Wed, 29 May 2019 00:09:58 +0300 In-Reply-To: <86zhnmn5mc.fsf@misasa.okayama-u.ac.jp> (Tak Kunihiro's message of "Thu, 16 May 2019 17:52:27 +0900") Message-ID: <878suqcml5.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddruddvhedgudehkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledrleeirdejfeenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrdeliedrjeefpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohephhhomhgvrhhoshdrmhhishgrshgrsehgmhgrihhlrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35487-done Cc: 35487-done@debbugs.gnu.org, martin rudalics , tkk@misasa.okayama-u.ac.jp X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > I configured `f' in help-mode in following way based on comments > and now it works good. > > Thank you Juri and Martin for the responses! You are welcome. Since it works good, I'm closing this request. ------------=_1559077862-26652-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 29 Apr 2019 12:30:45 +0000 Received: from localhost ([127.0.0.1]:38580 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hL5Qi-00018o-Lf for submit@debbugs.gnu.org; Mon, 29 Apr 2019 08:30:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59183) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hL5Qh-00018a-1Q for submit@debbugs.gnu.org; Mon, 29 Apr 2019 08:30:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:55537) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hL5Qb-0008UT-3R for submit@debbugs.gnu.org; Mon, 29 Apr 2019 08:30:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hL5QZ-0002a8-R3 for bug-gnu-emacs@gnu.org; Mon, 29 Apr 2019 08:30:36 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hL5QY-0008R0-KN for bug-gnu-emacs@gnu.org; Mon, 29 Apr 2019 08:30:35 -0400 Received: from mlsec.cc.okayama-u.ac.jp ([42.127.236.175]:34214) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hL5QW-0008Gx-O2 for bug-gnu-emacs@gnu.org; Mon, 29 Apr 2019 08:30:34 -0400 Received: from alml002.ouadm.okayama-u.ac.jp (unknown [42.127.236.168]) by mlsec.cc.okayama-u.ac.jp with smtp id 3aba_b6bd_50bf60fd_adcf_4a20_acd2_458995c877f6; Mon, 29 Apr 2019 21:30:20 +0900 Received: from localhost (p282048-ipngn200211tottori.tottori.ocn.ne.jp [114.151.88.48]) by alml002.ouadm.okayama-u.ac.jp (Postfix) with ESMTPSA id 663BE4C09A8; Mon, 29 Apr 2019 21:30:12 +0900 (JST) Date: Mon, 29 Apr 2019 21:30:14 +0900 (JST) Message-Id: <20190429.213014.526232842075202623.tkk@misasa.okayama-u.ac.jp> To: bug-gnu-emacs@gnu.org Subject: Make visiting function from help-mode more customizable From: Tak Kunihiro X-Mailer: Mew version 6.8 on Emacs 26.2 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-NAI-Spam-Flag: NO X-NAI-Spam-Level: ********** X-NAI-Spam-Threshold: 11 X-NAI-Spam-Score: 10.1 X-NAI-Spam-Rules: 6 Rules triggered TS_MSG_REP_80_512=10, RCVD_BAD_SIP=0.1, EDT_SA_AU_PASS=0, EDT_SA_DN_PASS=0, EDT_SA_TS_FAIL=0, RV6534=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6534> : inlines <7062> : streams <1820067> : uri <2838474> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 42.127.236.175 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit Cc: tkk@misasa.okayama-u.ac.jp X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) * Message I often want to visit function from help-mode in `this window' in stead of `other window'. To do so, I found that to revise help-function in help-function-def works. I propose to (1) move help-function described as lambda function out of button definition and (2) make function to visit function from help-mode customizable. After the revision, I can visit function from help-mode in `this windows' as shown below. #+begin_src emacs-lisp (define-key help-mode-map (kbd "f") (lambda () (interactive) (let ((help-switch-buffer-function 'switch-to-buffer)) (push-button)))) #+end_src I attach commit log and patch. * Commit log Author: Tak Kunihiro Make visiting function from help-mode more customizable * lisp/help-mode.el (define-button-type): Move definition of help-function out. (help-switch-buffer-function): Function to display buffer in help-mode. (help-find-function): Define help-function using a new variable `help-switch-buffer-function'. * Patch diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 6cc3f0d4f7..4e01e73181 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -192,32 +192,39 @@ 'help-customize-face (define-button-type 'help-function-def :supertype 'help-xref - 'help-function (lambda (fun &optional file type) - (or file - (setq file (find-lisp-object-file-name fun type))) - (if (not file) - (message "Unable to find defining file") - (require 'find-func) - (when (eq file 'C-source) - (setq file - (help-C-file-name (indirect-function fun) 'fun))) - ;; Don't use find-function-noselect because it follows - ;; aliases (which fails for built-in functions). - (let* ((location - (find-function-search-for-symbol fun type file)) - (position (cdr location))) - (pop-to-buffer (car location)) - (run-hooks 'find-function-after-hook) - (if position - (progn - ;; Widen the buffer if necessary to go to this position. - (when (or (< position (point-min)) - (> position (point-max))) - (widen)) - (goto-char position)) - (message "Unable to find location in file"))))) + 'help-function 'help-find-function 'help-echo (purecopy "mouse-2, RET: find function's definition")) +(defvar help-switch-buffer-function 'pop-to-buffer + "Function to display buffer in help-mode.") + +(defun help-find-function (fun &optional file type) + "Find object shown in help-mode." + (or file + (setq file (find-lisp-object-file-name fun type))) + (if (not file) + (message "Unable to find defining file") + (require 'find-func) + (when (eq file 'C-source) + (setq file + (help-C-file-name (indirect-function fun) 'fun))) + ;; Don't use find-function-noselect because it follows + ;; aliases (which fails for built-in functions). + (let* ((location + (find-function-search-for-symbol fun type file)) + (position (cdr location))) + ;; (pop-to-buffer (car location)) + (funcall help-switch-buffer-function (car location)) + (run-hooks 'find-function-after-hook) + (if position + (progn + ;; Widen the buffer if necessary to go to this position. + (when (or (< position (point-min)) + (> position (point-max))) + (widen)) + (goto-char position)) + (message "Unable to find location in file"))))) + (define-button-type 'help-function-cmacro ; FIXME: Obsolete since 24.4. :supertype 'help-xref 'help-function (lambda (fun file) ------------=_1559077862-26652-1--