unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73686: 31.0.50; ERC 5.6.1-git: back button gone from describe-face via erc-nicks-list-faces
@ 2024-10-08  2:47 J.P.
  2024-10-08  6:06 ` J.P.
       [not found] ` <87ttdn5dsz.fsf@neverwas.me>
  0 siblings, 2 replies; 8+ messages in thread
From: J.P. @ 2024-10-08  2:47 UTC (permalink / raw)
  To: 73686; +Cc: emacs-erc

The test `erc-nicks-list-faces' in test/lisp/erc/erc-nicks-tests.el now
fails [1]. This appears to be related to a recent change involving the
killing of local variables in `help-setup-xref'.

  e776df2a3eae0454ea85287e15ebba649bf8e918 is the first bad commit
  commit e776df2a3eae0454ea85287e15ebba649bf8e918
  Author: Dmitry Gutov <dmitry@gutov.dev>
  Date:   Sun Oct 6 04:31:31 2024 +0300
      help-setup-xref: Keep the local values only of some variables
      
      ,* lisp/help-mode.el (help-setup-xref): Kill all local variables,
      saving ones that are known to need to be preserved (bug#73637).
   lisp/help-mode.el | 37 +++++++++++++------------------------
   1 file changed, 13 insertions(+), 24 deletions(-)

The change also affects `list-faces-display' in faces.el, which
`erc-nicks-list-faces' depends on.

From emacs -Q:
1. M-x list-faces-display RET
2. TAB TAB RET C-x o (but see below*)
3. l -> (user-error "No previous help buffer")

Regarding (2), the Help buffer now opens in a split whereas before it
opened in the current window. The failing test expects the old behavior
but obviously doesn't have to for Emacs 31+. (That is to say we should
ensure the command still works and the test still passes on older Emacs
versions.)

I may not be able to look into this for a few days. Just filing a bug
now so folks will see it's been spotted.

Thanks.

[1] https://emba.gnu.org/emacs/emacs/-/jobs/90900/raw


In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.43, cairo version 1.18.0) of 2024-10-07 built on localhost
Repository revision: ff4de9eff30ade164655354f71e7cbca48135858
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12401002
System Description: Fedora Linux 40 (Workstation Edition)

Configured using:
 'configure --enable-check-lisp-object-type --enable-checking=yes,glyphs
 'CFLAGS=-O0 -g3'
 PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP
NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: ERC

Minor modes in effect:
  erc-truncate-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-ring-mode: t
  erc-nicks-mode: t
  erc-netsplit-mode: t
  erc-menu-mode: t
  erc-match-mode: t
  erc-list-mode: t
  erc-irccontrols-mode: t
  erc-keep-place-indicator-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  erc-scrolltobottom-mode: t
  erc-imenu-mode: t
  erc-pcomplete-mode: t
  erc-button-mode: t
  erc-fill-wrap-mode: t
  erc-fill-mode: t
  erc-stamp--date-mode: t
  erc-stamp--display-margin-mode: t
  erc-stamp-mode: t
  erc-autojoin-mode: t
  erc-networks-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  visual-line-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message yank-media dired dired-loaddefs
rfc822 mml mml-sec epa epg rfc6068 epg-config gnus-util mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
facemenu help-fns radix-tree mule-util compile text-property-search
comp-run comp-common network-stream puny nsm erc-truncate erc-track
erc-ring erc-nicks color erc-netsplit erc-menu erc-match erc-list
erc-goodies erc-imenu imenu erc-pcomplete time-date pcomplete comint
ansi-osc ansi-color ring erc-button browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util url-parse url-vars mailcap erc-fill erc-stamp
erc-join cus-edit pp wid-edit view cus-start cus-load erc derived
auth-source eieio eieio-core icons password-cache json map format-spec
erc-backend erc-networks easy-mmode byte-opt bytecomp byte-compile
erc-common inline cl-extra help-mode erc-compat cl-seq cl-macs gv pcase
rx compat subr-x cl-loaddefs cl-lib erc-loaddefs rmc iso-transl tooltip
cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic indonesian philippine cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 310654 14020) (symbols 48 15823 0) (strings 32 41880 7379)
 (string-bytes 1 1446301) (vectors 16 22633)
 (vector-slots 8 247090 18865) (floats 8 201 7029)
 (intervals 56 5336 0) (buffers 984 20))





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#73686: 31.0.50; ERC 5.6.1-git: back button gone from describe-face via erc-nicks-list-faces
  2024-10-08  2:47 bug#73686: 31.0.50; ERC 5.6.1-git: back button gone from describe-face via erc-nicks-list-faces J.P.
@ 2024-10-08  6:06 ` J.P.
       [not found] ` <87ttdn5dsz.fsf@neverwas.me>
  1 sibling, 0 replies; 8+ messages in thread
From: J.P. @ 2024-10-08  6:06 UTC (permalink / raw)
  To: 73686; +Cc: emacs-erc

"J.P." <jp@neverwas.me> writes:

> This appears to be related to a recent change involving the killing of
> local variables in `help-setup-xref'.

Poking around some, it seems the various `describe-*' commands in
help-fns.el run `help-setup-xref' before doing

  (with-help-window (help-buffer) ...)

And because `major-mode' is buffer-local, it gets wiped out with these
latest changes before `help-buffer' ever sees it:

  (defun help-buffer ()
    (buffer-name
     (if (and help-xref-following
              (derived-mode-p 'help-mode))
         (current-buffer)
       (get-buffer-create "*Help*"))))

(Here, `help-xref-following' is t thanks to `help-do-xref'.)

> Regarding (2), the Help buffer now opens in a split whereas before it
> opened in the current window. The failing test expects the old behavior

This appears to happen when the `help-mode' (turned `fundamental-mode')
buffer from which `describe-*' is run isn't named `*Help*', as is the
case with `list-faces-display' and `erc-nicks-list-faces'.

As for fixing this, I wonder if we can somehow expand the role of
`help-buffer-under-preparation' (or `help-xref-following') so that
instead of t, it's bound to the last value of `major-mode' prior to
`help-setup-xref' running. And then `help-buffer' could first check this
stashed value before considering the current `major-mode' (like via
`provided-mode-derived-p' or whatever).





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#73686: 31.0.50; ERC 5.6.1-git: back button gone from describe-face via erc-nicks-list-faces
       [not found] ` <87ttdn5dsz.fsf@neverwas.me>
@ 2024-10-08 21:07   ` J.P.
       [not found]   ` <87y12y1exp.fsf@neverwas.me>
  2024-10-09  1:05   ` Dmitry Gutov
  2 siblings, 0 replies; 8+ messages in thread
From: J.P. @ 2024-10-08 21:07 UTC (permalink / raw)
  To: 73686; +Cc: emacs-erc

Small correction:

> From emacs -Q:
> 1. M-x list-faces-display RET
> 2. TAB TAB RET C-x o (but see below*)
     ^
Missing a C-x o here in the original recipe.

So I doubt this is directly related, but I'm noticing another
peculiarity regarding help buffers not named `*Help*'. As you'd expect,
going back via a back button replaces the window buffer with the
previous one. And though typing "l" does that as well, it also
re-creates the previous buffer in a new window, resulting in different
buffers with the same content (the new one being the default "*Help*").

From emacs -Q (on Emacs 30):

1. M-x list-faces-display RET
2. C-x o TAB TAB RET
3. In the help buffer for `abbrev-table-name':
   <backtab> <backtab> RET
4. In the help buffer for `font-lock-function-name-face':
   <backtab> RET
5. Back in `abbrev-table-name':
   TAB RET (should take you back to "*Faces*")

Now start a new session, repeating 1-3. For 4, hit "l" instead, and
witness the unwanted default "*Help*" buffer pop up in another window.
Superficially, I think the disparity results from `help-xref-following'
being t in the base recipe (at the hands of `help-do-xref'):

  * help-xref-go-back(#<buffer *Faces*>)
    help-do-xref(nil help-xref-go-back (#<buffer *Faces*>))
    help-button-action(#<marker (moves after insertion) at 751 in *Faces*>)
    button-activate(#<marker (moves after insertion) at 751 in *Faces*> nil)
    push-button(751)

Which allows for buffer reuse in `help-buffer'. No such arrangement
occurs with the "l" variant:

  * help-xref-go-back(#<buffer *Faces*>)
    help-go-back()
    funcall-interactively(help-go-back)





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#73686: 31.0.50; ERC 5.6.1-git: back button gone from describe-face via erc-nicks-list-faces
       [not found]   ` <87y12y1exp.fsf@neverwas.me>
@ 2024-10-08 23:41     ` J.P.
       [not found]     ` <87o73uyxgv.fsf@neverwas.me>
  1 sibling, 0 replies; 8+ messages in thread
From: J.P. @ 2024-10-08 23:41 UTC (permalink / raw)
  To: 73686; +Cc: emacs-erc

[-- Attachment #1: Type: text/plain, Size: 276 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-POC-Overload-help-xref-following-for-non-default-hel.patch --]
[-- Type: text/x-patch, Size: 4828 bytes --]

From 8acedc71dc1344daac90a79378dad894dcd98bab Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@neverwas.me>
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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#73686: 31.0.50; ERC 5.6.1-git: back button gone from describe-face via erc-nicks-list-faces
       [not found]     ` <87o73uyxgv.fsf@neverwas.me>
@ 2024-10-09  0:59       ` J.P.
       [not found]       ` <8734l6xf91.fsf@neverwas.me>
  1 sibling, 0 replies; 8+ messages in thread
From: J.P. @ 2024-10-09  0:59 UTC (permalink / raw)
  To: 73686; +Cc: emacs-erc

[-- Attachment #1: Type: text/plain, Size: 209 bytes --]

Actually, we can't count on `help-buffer-under-preparation' being
non-nil in `describe-*' commands (unless we're willing to modify all the
ones in which it isn't, which sounds rather dubious). Patch updated.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0000-v1-v2.diff --]
[-- Type: text/x-patch, Size: 2361 bytes --]

From 0e19883da585b0105f2340ac7c23764b3ea939c9 Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@neverwas.me>
Date: Tue, 8 Oct 2024 17:33:11 -0700
Subject: [PATCH 0/1] *** NOT A PATCH ***

*** BLURB HERE ***

F. Jason Park (1):
  [POC] Overload help-xref-following for non-default help buffers

 lisp/help-mode.el                     | 21 +++++++++++++--------
 test/lisp/emacs-lisp/package-tests.el |  2 +-
 test/lisp/help-mode-tests.el          | 14 +++++++++++++-
 3 files changed, 27 insertions(+), 10 deletions(-)

Interdiff:
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index f704098b2dc..77473125694 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -524,16 +524,14 @@ help-buffer
   "Return the name of a buffer for inserting help.
 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.
+do so if `help-xref-following' is the symbol of a major mode deriving
+from `help-mode' and the current buffer is in `fundamental-mode'.
 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
             (if (or (eq help-xref-following t)
-                    (not (and help-buffer-under-preparation
-                              (eq major-mode 'fundamental-mode))))
+                    (not (eq major-mode 'fundamental-mode)))
                 (derived-mode-p 'help-mode) ; current buffer
               (provided-mode-derived-p help-xref-following '(help-mode))))
        (current-buffer)
diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el
index 692d6550250..8236f834b02 100644
--- a/test/lisp/emacs-lisp/package-tests.el
+++ b/test/lisp/emacs-lisp/package-tests.el
@@ -172,7 +172,7 @@ with-fake-help-buffer
   `(with-temp-buffer
     (help-mode)
     ;; Trick `help-buffer' into using the temp buffer.
-    (let ((help-xref-following t))
+    (let ((help-xref-following major-mode))
       ,@body)))
 
 (defun package-test-strip-version (dir)
-- 
2.46.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0001-POC-Overload-help-xref-following-for-non-default-hel.patch --]
[-- Type: text/x-patch, Size: 5486 bytes --]

From 0e19883da585b0105f2340ac7c23764b3ea939c9 Mon Sep 17 00:00:00 2001
From: "F. Jason Park" <jp@neverwas.me>
Date: Tue, 8 Oct 2024 15:58:49 -0700
Subject: [PATCH 1/1] [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' before returning the current buffer.
This should also probably check whether `help-buffer-under-preparation'
is non-nil, but many `describe-*' functions do not bind it.
(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/emacs-lisp/package-tests.el (with-fake-help-buffer): Use
value of `major-mode' instead of t for `help-xref-following'.
* 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)
(See also: bug#73637.)
---
 lisp/help-mode.el                     | 21 +++++++++++++--------
 test/lisp/emacs-lisp/package-tests.el |  2 +-
 test/lisp/help-mode-tests.el          | 14 +++++++++++++-
 3 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 4ee4f4156a1..77473125694 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -516,19 +516,24 @@ 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 `help-xref-following' is the symbol of a major mode deriving
+from `help-mode' and the current buffer is in `fundamental-mode'.
 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 (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 +797,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 +817,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 +899,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/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el
index 692d6550250..8236f834b02 100644
--- a/test/lisp/emacs-lisp/package-tests.el
+++ b/test/lisp/emacs-lisp/package-tests.el
@@ -172,7 +172,7 @@ with-fake-help-buffer
   `(with-temp-buffer
     (help-mode)
     ;; Trick `help-buffer' into using the temp buffer.
-    (let ((help-xref-following t))
+    (let ((help-xref-following major-mode))
       ,@body)))
 
 (defun package-test-strip-version (dir)
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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#73686: 31.0.50; ERC 5.6.1-git: back button gone from describe-face via erc-nicks-list-faces
       [not found] ` <87ttdn5dsz.fsf@neverwas.me>
  2024-10-08 21:07   ` J.P.
       [not found]   ` <87y12y1exp.fsf@neverwas.me>
@ 2024-10-09  1:05   ` Dmitry Gutov
  2024-10-09  1:24     ` J.P.
  2 siblings, 1 reply; 8+ messages in thread
From: Dmitry Gutov @ 2024-10-09  1:05 UTC (permalink / raw)
  To: J.P., 73686; +Cc: emacs-erc

Hi!

On 08/10/2024 09:06, J.P. wrote:
> And because `major-mode' is buffer-local, it gets wiped out with these
> latest changes before `help-buffer' ever sees it:

This is a problem, sorry.

The command in question (erc-nicks-list-faces) doesn't really work for 
me -- it errors with

   No faces matching "\`erc-nicks-"

I've just pushed the patch below to master. Could you try it and see if 
it helps?

diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 4ee4f4156a1..f233633d2ca 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -505,7 +505,8 @@ help-setup-xref
  because we want to record the \"previous\" position of point so we can
  restore it properly when going back."
    (with-current-buffer (help-buffer)
-    (kill-all-local-variables)
+     ;; Re-enable major mode, killing all other local vars.
+    (funcall major-mode)
      (when help-xref-stack-item
        (push (cons (point) help-xref-stack-item) help-xref-stack)
        (setq help-xref-forward-stack nil))






^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#73686: 31.0.50; ERC 5.6.1-git: back button gone from describe-face via erc-nicks-list-faces
  2024-10-09  1:05   ` Dmitry Gutov
@ 2024-10-09  1:24     ` J.P.
  0 siblings, 0 replies; 8+ messages in thread
From: J.P. @ 2024-10-09  1:24 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-erc, 73686

Dmitry Gutov <dmitry@gutov.dev> writes:

> Hi!
>
> On 08/10/2024 09:06, J.P. wrote:
>> And because `major-mode' is buffer-local, it gets wiped out with these
>> latest changes before `help-buffer' ever sees it:
>
> This is a problem, sorry.

No worries.

>
> The command in question (erc-nicks-list-faces) doesn't really work for 
> me -- it errors with
>
>    No faces matching "\`erc-nicks-"

Oh, right. That command only works when `erc-nicks-mode' is enabled. But
you just can use `list-faces-display' instead, and then click on one of
the "abcdefghijklmnopqrstuvwxyz" buttons.

>
> I've just pushed the patch below to master. Could you try it and see if 
> it helps?

Seems to fix the issue. Thanks!





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#73686: 31.0.50; ERC 5.6.1-git: back button gone from describe-face via erc-nicks-list-faces
       [not found]       ` <8734l6xf91.fsf@neverwas.me>
@ 2024-10-09  3:00         ` J.P.
  0 siblings, 0 replies; 8+ messages in thread
From: J.P. @ 2024-10-09  3:00 UTC (permalink / raw)
  To: 73686-done; +Cc: emacs-erc

This has been fixed by:

  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=ef87ce0f

I will open another bug for the help-go-back stuff mentioned up thread.

Thanks and closing.





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-10-09  3:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08  2:47 bug#73686: 31.0.50; ERC 5.6.1-git: back button gone from describe-face via erc-nicks-list-faces J.P.
2024-10-08  6:06 ` J.P.
     [not found] ` <87ttdn5dsz.fsf@neverwas.me>
2024-10-08 21:07   ` J.P.
     [not found]   ` <87y12y1exp.fsf@neverwas.me>
2024-10-08 23:41     ` J.P.
     [not found]     ` <87o73uyxgv.fsf@neverwas.me>
2024-10-09  0:59       ` J.P.
     [not found]       ` <8734l6xf91.fsf@neverwas.me>
2024-10-09  3:00         ` J.P.
2024-10-09  1:05   ` Dmitry Gutov
2024-10-09  1:24     ` J.P.

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).