From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "J.P." Newsgroups: gmane.emacs.bugs Subject: bug#73686: 31.0.50; ERC 5.6.1-git: back button gone from describe-face via erc-nicks-list-faces Date: Tue, 08 Oct 2024 16:41:04 -0700 Message-ID: <87o73uyxgv.fsf__38095.4691719793$1728430943$gmane$org@neverwas.me> References: <875xq38g4y.fsf__36834.6894437977$1728355711$gmane$org@neverwas.me> <87ttdn5dsz.fsf@neverwas.me> <87y12y1exp.fsf@neverwas.me> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4835"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-erc@gnu.org To: 73686@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 09 01:42:15 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1syJqI-00015b-6B for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 09 Oct 2024 01:42:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syJpz-00023E-I8; Tue, 08 Oct 2024 19:41:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syJpw-00022u-WF for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2024 19:41:53 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syJpw-0000TD-H3 for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2024 19:41:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=kWyZGxZSzOrRqQYVvi5y9CnA6bRagEOp0DPejvWmYTY=; b=vdKR4YVfudBJ+cRY9Lj9bH778xFAhvdf8ZXD2C3rVsNsyXQ8NZ/azrHCWtSIYGwMoroOLqzgnK1c7voG7euLwyfajsYEMsFHVw/wzrkaeM0Gz12QzR8kzEd3e93fqmecCvw6Mwo8CGvuICRqIgK5fouN6c6g0PTCPAQLXskhgWKk5VuHnINs9BKZfWGYuL9UfEgwwATWlBJLhUOFbK3M3mlZwp/Po40h6vmAFRjVJkxaQWwx36SgSJ0VbR77ZWkSKw+6rIzkCwcDpTPXapjyulVSnR1H+/s+MlgRODyWq32+IPxbrki4n+1JFzi9UkYygfpq03wOArhazAz4C7H7xA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1syJq5-0006Q4-Kz for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2024 19:42:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "J.P." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Oct 2024 23:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73686 X-GNU-PR-Package: emacs Original-Received: via spool by 73686-submit@debbugs.gnu.org id=B73686.172843088124619 (code B ref 73686); Tue, 08 Oct 2024 23:42:01 +0000 Original-Received: (at 73686) by debbugs.gnu.org; 8 Oct 2024 23:41:21 +0000 Original-Received: from localhost ([127.0.0.1]:54878 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1syJpQ-0006P1-CR for submit@debbugs.gnu.org; Tue, 08 Oct 2024 19:41:20 -0400 Original-Received: from mail-108-mta77.mxroute.com ([136.175.108.77]:43837) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1syJpO-0006Oq-FD for 73686@debbugs.gnu.org; Tue, 08 Oct 2024 19:41:19 -0400 Original-Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta77.mxroute.com (ZoneMTA) with ESMTPSA id 1926e8204e30003e01.001 for <73686@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Tue, 08 Oct 2024 23:41:07 +0000 X-Zone-Loop: 17090254d5e18defeabaf731d0ddf82e5eb8a0487112 X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me ; s=x; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=kWyZGxZSzOrRqQYVvi5y9CnA6bRagEOp0DPejvWmYTY=; b=dWO8EfHITQm2o3mlJV5M15IoqB PMe5LHqE+1O+bERGYXyqpbXrD4PmHOSR/ctpf7hDUMZse3ynXZveOyKJ11uUz/Mg1XnfGHMwDHJQr zv7FQtGJBY0ZuVC0qXCZZJHOcIpriLyAS5Kiyw+6UZxncOSPpORGILo8++E3GMnQc+udYaPKPp+9v DaEdmLwt/A6uy5cOleFKei1xQbCJxdKh1f6j6m+YwtDWbJZKwAnfE1tsh8GTqJcg5/UMM3ucSDhgz JC3bRihQ68aoMZ1WiE9ldNtOEkFUcJXk8eOYYOnbCMqkgL5MT2ZA3qgxixRr6e70LTaiiy4gH+Gp+ LFReu0zA==; In-Reply-To: <87y12y1exp.fsf@neverwas.me> (J. P.'s message of "Tue, 08 Oct 2024 14:07:46 -0700") X-Authenticated-Id: masked@neverwas.me X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:293175 Archived-At: --=-=-= Content-Type: text/plain The attached PoC patch blindly tries to implement the approach loosely theorized about in previous posts. While it seems to solve the issue at hand (in a vacuum), it may well introduce others because I know basically nothing about the help system and how it's meant to work. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-POC-Overload-help-xref-following-for-non-default-hel.patch >From 8acedc71dc1344daac90a79378dad894dcd98bab Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Tue, 8 Oct 2024 15:58:49 -0700 Subject: [PATCH] [POC] Overload help-xref-following for non-default help buffers * lisp/help-mode.el (help-xref-following): Mention in doc that value may be the symbol of a major mode. (help-buffer): When the current buffer is in `fundamental-mode', check to see if the value of `help-xref-following' is the symbol of a major mode deriving from `help-mode' and `help-buffer-under-preparation' is non-nil. If so, return the current buffer. (help-xref-go-back, help-xref-go-forward): Use `help-do-xref' instead of `apply' to call methods. (help-do-xref): Bind `help-xref-following' to the value of `major-mode' instead of t. * test/lisp/help-mode-tests.el (help-mode-tests-help-buffer-current-buffer): Add case for `help-xref-following' being a major-mode rather than t. (Bug#73686) --- lisp/help-mode.el | 23 +++++++++++++++-------- test/lisp/help-mode-tests.el | 14 +++++++++++++- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 4ee4f4156a1..f704098b2dc 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -516,19 +516,26 @@ help-setup-xref (setq help-xref-stack-item item))) (defvar help-xref-following nil - "Non-nil when following a help cross-reference.") + "Non-nil when following a help cross-reference. +May be the value of `major-mode' when an instigating button was clicked.") ;;;###autoload (defun help-buffer () "Return the name of a buffer for inserting help. -If `help-xref-following' is non-nil and the current buffer is -derived from `help-mode', this is the name of the current buffer. - +If `help-xref-following' is t and the current buffer is derived from +`help-mode', return the current buffer's name. As a special case, also +do so if these three conditions are met: `help-xref-following' is the +symbol of a major mode deriving from `help-mode', the current buffer is +in `fundamental-mode', and `help-buffer-under-preparation' is non-nil. Otherwise, return \"*Help*\", creating a buffer with that name if it does not already exist." (buffer-name ;for with-output-to-temp-buffer (if (and help-xref-following - (derived-mode-p 'help-mode)) + (if (or (eq help-xref-following t) + (not (and help-buffer-under-preparation + (eq major-mode 'fundamental-mode)))) + (derived-mode-p 'help-mode) ; current buffer + (provided-mode-derived-p help-xref-following '(help-mode)))) (current-buffer) (get-buffer-create "*Help*")))) @@ -792,7 +799,7 @@ help-xref-go-back position (car item) method (cadr item) args (cddr item)))) - (apply method args) + (help-do-xref nil method args) (with-current-buffer buffer (if (get-buffer-window buffer) (set-window-point (get-buffer-window buffer) position) @@ -812,7 +819,7 @@ help-xref-go-forward position (car item) method (cadr item) args (cddr item)))) - (apply method args) + (help-do-xref nil method args) (with-current-buffer buffer (if (get-buffer-window buffer) (set-window-point (get-buffer-window buffer) position) @@ -894,7 +901,7 @@ help-do-xref Things are set up properly so that the resulting help buffer has a proper [back] button." ;; There is a reference at point. Follow it. - (let ((help-xref-following t)) + (let ((help-xref-following major-mode)) (apply function (if (eq function 'info) (append args (list (generate-new-buffer-name "*info*"))) args)))) diff --git a/test/lisp/help-mode-tests.el b/test/lisp/help-mode-tests.el index 2e64b12732e..968ed7da72e 100644 --- a/test/lisp/help-mode-tests.el +++ b/test/lisp/help-mode-tests.el @@ -39,7 +39,19 @@ help-mode-tests-help-buffer-current-buffer (help-mode) (let ((help-xref-following t)) (should (equal (buffer-name (current-buffer)) - (help-buffer)))))) + (help-buffer))))) + + ;; Returns the current `fundamental-mode' buffer when an xref button + ;; is clicked and the resulting action function, such as the various + ;; `describe-*' commands, binds `help-buffer-under-preparation' to + ;; something non-nil. + (should (eq major-mode 'fundamental-mode)) + (let ((help-xref-following 'help-mode) + (help-buffer-under-preparation t)) + (should (equal (buffer-name (current-buffer)) + (help-buffer))) + (with-current-buffer "*scratch*" + (should (equal "*Help*" (help-buffer)))))) (ert-deftest help-mode-tests-make-xrefs () (with-temp-buffer -- 2.46.2 --=-=-=--