[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#39805: 28.0.50; scan-sexps (scan_lists) incorrectly parsing circular

From: Noam Postavsky
Subject: bug#39805: 28.0.50; scan-sexps (scan_lists) incorrectly parsing circular list
Date: Thu, 27 Feb 2020 21:34:07 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

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

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

Here is the patch intended for emacs-27:

>From 3b0b1b17c59341b12a502c0ea87c6125cc445494 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <address@hidden>
Date: Thu, 27 Feb 2020 21:09:59 -0500
Subject: [PATCH] Fix describe-variable on values with circular syntax

* 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
                     (let ((buf (current-buffer)))
+                        (lisp-mode-variables nil)
+                        (set-syntax-table emacs-lisp-mode-syntax-table)
                         (insert print-rep)
                         (let ((pp-buffer (current-buffer)))

No Wayman <address@hidden> 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'.
      (advice-add #'pp-buffer :before #'emacs-lisp-mode)
          (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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]