Subject: bug#73872: 30.0.91; emacs-lisp-mode-syntax-table active when calling `describe-variable' on variable with textually large value.

From: Sigurd Dam Sonniks <[email-masked]>
Date: Fri, 18 Oct 2024 22:14:21 +0000

Hello Emacs folks!

When you call `describle-variable' on a variable with a value that's
large enough that it's moved to the end of the help buffer, the syntax
table is changed to `emacs-lisp-mode-syntax-table' but never changed
back. There is a very easy fix where you just set it back to
`help-mode-syntax-table' at the end of the enclosing
`with-current-buffer', but I guess you could also switch to a
temporary buffer instead. Below is the relevant code snippet with the
first suggested fix applied.

;; If the value is large, move it to the end.
(with-current-buffer standard-output
      (when (> (count-lines (point-min) (point-max)) 10)
            ;; Note that setting the syntax table like below
            ;; makes forward-sexp move over a `'s' at the end
            ;; of a symbol.
            (set-syntax-table emacs-lisp-mode-syntax-table)
            (goto-char val-start-pos)
            (when (looking-at "value is") (replace-match ""))
            (save-excursion
              (insert "\n\nValue:")
      (setq-local help-button-cache (point-marker)))
            (insert "value is shown ")
            (insert-button "below"
                               'action help-button-cache
                               'follow-link t
                               'help-echo "mouse-2, RET: show value")
            (insert ".\n")
    (set-syntax-table help-mode-syntax-table)))

Thank you very much for all your work. I absolutely adore Emacs.

Kind regards,
Sigurd Dam Sonniks

In GNU Emacs 30.0.91 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.18.2, Xaw3d scroll bars)
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: NixOS 24.11 (Vicuna)

Configured using:
 'configure
 --prefix=/nix/store/6qc388fy8gl95smi8q0az92d558nkp4k-emacs-30.0.91
 --disable-build-details --with-modules --with-x-toolkit=lucid
 --with-cairo --with-xft --with-compress-install
 --with-toolkit-scroll-bars --with-native-compilation
 --without-imagemagick --with-mailutils --without-small-ja-dic
 --with-tree-sitter --with-xinput2 --without-xwidgets --with-dbus
 --with-selinux'

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

Important settings:
  value of $EMACSLOADPATH: /nix/store/ml4x8pxvz40klw1yabgbjrrpjxlgbbb0-emacs-packages-deps/share/emacs/site-lisp:
  value of $EMACSNATIVELOADPATH: /nix/store/ml4x8pxvz40klw1yabgbjrrpjxlgbbb0-emacs-packages-deps/share/emacs/native-lisp:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  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
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/nix/store/ml4x8pxvz40klw1yabgbjrrpjxlgbbb0-emacs-packages-deps/share/emacs/site-lisp/elpa/external-completion-0.1/external-completion hides /nix/store/6qc388fy8gl95smi8q0az92d558nkp4k-emacs-30.0.91/share/emacs/30.0.91/lisp/external-completion
/nix/store/ml4x8pxvz40klw1yabgbjrrpjxlgbbb0-emacs-packages-deps/share/emacs/site-lisp/elpa/jsonrpc-1.0.25/jsonrpc hides /nix/store/6qc388fy8gl95smi8q0az92d558nkp4k-emacs-30.0.91/share/emacs/30.0.91/lisp/jsonrpc
/nix/store/ml4x8pxvz40klw1yabgbjrrpjxlgbbb0-emacs-packages-deps/share/emacs/site-lisp/elpa/transient-20240819.1250/transient hides /nix/store/6qc388fy8gl95smi8q0az92d558nkp4k-emacs-30.0.91/share/emacs/30.0.91/lisp/transient
/nix/store/ml4x8pxvz40klw1yabgbjrrpjxlgbbb0-emacs-packages-deps/share/emacs/site-lisp/elpa/eglot-1.17/eglot hides /nix/store/6qc388fy8gl95smi8q0az92d558nkp4k-emacs-30.0.91/share/emacs/30.0.91/lisp/progmodes/eglot
/nix/store/ml4x8pxvz40klw1yabgbjrrpjxlgbbb0-emacs-packages-deps/share/emacs/site-lisp/elpa/project-0.11.1/project hides /nix/store/6qc388fy8gl95smi8q0az92d558nkp4k-emacs-30.0.91/share/emacs/30.0.91/lisp/progmodes/project
/nix/store/ml4x8pxvz40klw1yabgbjrrpjxlgbbb0-emacs-packages-deps/share/emacs/site-lisp/elpa/xref-1.7.0/xref hides /nix/store/6qc388fy8gl95smi8q0az92d558nkp4k-emacs-30.0.91/share/emacs/30.0.91/lisp/progmodes/xref
/nix/store/ml4x8pxvz40klw1yabgbjrrpjxlgbbb0-emacs-packages-deps/share/emacs/site-lisp/elpa/flymake-1.3.7/flymake hides /nix/store/6qc388fy8gl95smi8q0az92d558nkp4k-emacs-30.0.91/share/emacs/30.0.91/lisp/progmodes/flymake
/nix/store/ml4x8pxvz40klw1yabgbjrrpjxlgbbb0-emacs-packages-deps/share/emacs/site-lisp/elpa/compat-30.0.0.0/compat hides /nix/store/6qc388fy8gl95smi8q0az92d558nkp4k-emacs-30.0.91/share/emacs/30.0.91/lisp/emacs-lisp/compat
/nix/store/ml4x8pxvz40klw1yabgbjrrpjxlgbbb0-emacs-packages-deps/share/emacs/site-lisp/elpa/seq-2.24/seq hides /nix/store/6qc388fy8gl95smi8q0az92d558nkp4k-emacs-30.0.91/share/emacs/30.0.91/lisp/emacs-lisp/seq
/nix/store/ml4x8pxvz40klw1yabgbjrrpjxlgbbb0-emacs-packages-deps/share/emacs/site-lisp/elpa/eldoc-1.15.0/eldoc hides /nix/store/6qc388fy8gl95smi8q0az92d558nkp4k-emacs-30.0.91/share/emacs/30.0.91/lisp/emacs-lisp/eldoc

Features:
(mailalias rmail auth-source cl-seq eieio eieio-core cl-macs icons json
map byte-opt gv bytecomp byte-compile thingatpt help-fns radix-tree
help-mode pp shadow sort mail-extr emacsbug message mailcap yank-media
puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived
epg rfc6068 epg-config gnus-util text-property-search time-date subr-x
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils 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
dynamic-setting system-font-setting font-render-setting cairo x-toolkit
xinput2 x multi-tty move-toolbar make-network-process native-compile
emacs)

Memory information:
((conses 16 83734 22304) (symbols 48 7341 9) (strings 32 24215 2414)
 (string-bytes 1 761000) (vectors 16 14459)
 (vector-slots 8 178912 15298) (floats 8 32 11) (intervals 56 330 0)
 (buffers 992 12))