all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: No Wayman <iarchivedmywholelife@gmail.com>
Cc: 39805@debbugs.gnu.org
Subject: bug#39805: 28.0.50; scan-sexps (scan_lists) incorrectly parsing circular list
Date: Thu, 27 Feb 2020 21:34:07 -0500	[thread overview]
Message-ID: <87a753a19c.fsf@gmail.com> (raw)
In-Reply-To: <87mu94kkrq.fsf@gmail.com> (No Wayman's message of "Thu, 27 Feb 2020 12:22:34 -0500")

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

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:


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

From 3b0b1b17c59341b12a502c0ea87c6125cc445494 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@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


[-- Attachment #3: Type: text/plain, Size: 908 bytes --]


No Wayman <iarchivedmywholelife@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))


  reply	other threads:[~2020-02-28  2:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26 21:33 bug#39805: 28.0.50; scan-sexps (scan_lists) incorrectly parsing circular list No Wayman
2020-02-27  1:38 ` Noam Postavsky
2020-02-27 17:22   ` No Wayman
2020-02-28  2:34     ` Noam Postavsky [this message]
2020-02-28  4:01       ` No Wayman
2020-03-04  3:09       ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a753a19c.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=39805@debbugs.gnu.org \
    --cc=iarchivedmywholelife@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.