GNU bug report logs -
#39805
describe-variable fails to print some circular list values
Previous Next
Reported by: No Wayman <iarchivedmywholelife <at> gmail.com>
Date: Wed, 26 Feb 2020 21:50:01 UTC
Severity: normal
Tags: confirmed, fixed, patch
Found in versions 28.0.50, 26.1
Fixed in version 27.1
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #20 received at control <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
retitle 39805 describe-variable fails to print some circular list values
# describe-variable only fails starting from 26.1
notfound 39805 25.3
found 39805 26.1
tags 39805 + patch
quit
For the record, the pp-buffer call in the original report fails in Emacs
25 (and earlier, I assume), but the describe-variable case only fails
starting from 26.1, specifically commit 2c18969c81.
[1: 2c18969c81]: 2017-03-02 02:08:32 -0500
* lisp/help-fns.el (describe-variable): Use cl-print for the value
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=2c18969c810f338d73beda592ee5af7103132e97
Here is the patch intended for emacs-27:
[0001-Fix-describe-variable-on-values-with-circular-syntax.patch (text/x-diff, inline)]
From 3b0b1b17c59341b12a502c0ea87c6125cc445494 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Thu, 27 Feb 2020 21:09:59 -0500
Subject: [PATCH] Fix describe-variable on values with circular syntax
(Bug#39805)
* lisp/help-fns.el (describe-variable): Set syntax tables before
calling pp-buffer.
---
lisp/help-fns.el | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 0e2ae6b3c3..1be8e0ab08 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -1000,6 +1000,8 @@ describe-variable
(terpri)
(let ((buf (current-buffer)))
(with-temp-buffer
+ (lisp-mode-variables nil)
+ (set-syntax-table emacs-lisp-mode-syntax-table)
(insert print-rep)
(pp-buffer)
(let ((pp-buffer (current-buffer)))
--
2.11.0
[Message part 3 (text/plain, inline)]
No Wayman <iarchivedmywholelife <at> gmail.com> writes:
> In the meantime, I'd like to be able to offer the users of my package
> a solution if they hit this bug. This seems to work for me, but I
> haven't written much, and am a bit leery of, elisp advice. Would you
> consider this an appropriate workaround?:
Mostly yes, but IMO it's kind of over-engineered. I would do just:
(defun workaround/describe-variable-print-bug (original-function &rest args)
"Put temp buffer in emacs-lisp-mode before `pp-buffer'.
https://debbugs.gnu.org/39805#8"
(advice-add #'pp-buffer :before #'emacs-lisp-mode)
(unwind-protect
(apply original-function args)
(advice-remove #'pp-buffer #'emacs-lisp-mode)))
(when (= emacs-major-version 26) ;; Work around Bug#39805.
(advice-add #'describe-variable :around
#'workaround/describe-variable-print-bug))
This bug report was last modified 5 years and 83 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.