emacs-diffs
[Top][All Lists]
Advanced

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

master 08a74ab05a 3/3: Cease emitting negative file offsets for user var


From: Mattias Engdegård
Subject: master 08a74ab05a 3/3: Cease emitting negative file offsets for user variables
Date: Sun, 7 Aug 2022 05:13:44 -0400 (EDT)

branch: master
commit 08a74ab05a2dcca261fe6adaa839a936b5c123c0
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    Cease emitting negative file offsets for user variables
    
    'User variables' were made obsolete in Emacs 24 along with
    user-variable-p; the sign of the position in (#$ . POS) hasn't
    mattered since.
    
    * lisp/emacs-lisp/bytecomp.el (byte-compile-output-docform):
    Don't emit negative position when doc string starts with `*`.
    * src/lread.c (get_lazy_string): Explain.
---
 lisp/emacs-lisp/bytecomp.el | 15 +++------------
 src/lread.c                 |  4 +++-
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index b1f4f01b3a..d8a5dd20f6 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2451,18 +2451,9 @@ list that represents a doc string reference.
       (let (position
             (print-symbols-bare t))     ; Possibly redundant binding.
         ;; Insert the doc string, and make it a comment with #@LENGTH.
-        (and (>= (nth 1 info) 0)
-             dynamic-docstrings
-             (progn
-               (setq position
-                     (byte-compile-output-as-comment
-                      (nth (nth 1 info) form) nil))
-               ;; If the doc string starts with * (a user variable),
-               ;; negate POSITION.
-               (if (and (stringp (nth (nth 1 info) form))
-                        (> (length (nth (nth 1 info) form)) 0)
-                        (eq (aref (nth (nth 1 info) form) 0) ?*))
-                   (setq position (- position)))))
+        (when (and (>= (nth 1 info) 0) dynamic-docstrings)
+             (setq position (byte-compile-output-as-comment
+                             (nth (nth 1 info) form) nil)))
 
         (let ((print-continuous-numbering t)
               print-number-table
diff --git a/src/lread.c b/src/lread.c
index d16df32ca3..ccccd79cd7 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3486,7 +3486,9 @@ get_lazy_string (Lisp_Object val)
      unibyte string.  If it is actually a doc string, caller must make
      it multibyte.  */
 
-  /* Position is negative for user variables.  */
+  /* We used to emit negative positions for 'user variables' (whose doc
+     strings started with an asterisk); take the absolute value for
+     compatibility.  */
   EMACS_INT pos = eabs (XFIXNUM (XCDR (val)));
   struct saved_string *ss = &saved_strings[0];
   struct saved_string *ssend = ss + ARRAYELTS (saved_strings);



reply via email to

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