emacs-bug-tracker
[Top][All Lists]
Advanced

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

bug#59710: closed (Wrong type argument when editing a multisession varia


From: GNU bug Tracking System
Subject: bug#59710: closed (Wrong type argument when editing a multisession variable)
Date: Fri, 02 Dec 2022 13:32:01 +0000

Your message dated Fri, 2 Dec 2022 14:30:52 +0100
with message-id 
<CAAeL0SR9Vp+3TKCcZVTNERk6n2cJvvDOHZKnD1VcdOoQ=eLrmg@mail.gmail.com>
and subject line Re: bug#59710: Wrong type argument when editing a multisession 
variable
has caused the debbugs.gnu.org bug report #59710,
regarding Wrong type argument when editing a multisession variable
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
59710: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59710
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: Wrong type argument when editing a multisession variable Date: Wed, 30 Nov 2022 02:49:15 +0100
Package: emacs
Version: 29.0.60
Severity: normal
X-Debbugs-Cc: "Lars Ingebrigtsen" <larsi@gnus.org>


;;; init.el
(require 'multisession)
(define-multisession-variable test-var nil "Test var" :package "test")
(setf (multisession-value test-var) t)
;;; end of init.el

emacs
M-x list-multisession-values <RET>
e

Debugger entered--Lisp error: (wrong-type-argument symbolp (intern (cdr id)))
  multisession-edit-value(("test" . "test-var"))
  funcall-interactively(multisession-edit-value ("test" . "test-var"))
  command-execute(multisession-edit-value)


The problem comes from this change

  commit bd586121ac21e046f60f75eeb0200866c38d6f9f
  Author: Lars Ingebrigtsen <larsi@gnus.org>
  Date:   2022-01-22 11:56:13 +0100

      Make the test for existing multisession variables more sensible

      * lisp/emacs-lisp/multisession.el (multisession-edit-value):
      Unconfuse the code.

  diff --git a/lisp/emacs-lisp/multisession.el b/lisp/emacs-lisp/multisession.el
  index 4a293796a8..25307594c6 100644
  --- a/lisp/emacs-lisp/multisession.el
  +++ b/lisp/emacs-lisp/multisession.el
  @@ -437,8 +437,8 @@ multisession-edit-value
     (let* ((object (or
                     ;; If the multisession variable already exists, use
                     ;; it (so that we update it).
  -                  (and (boundp (intern-soft (cdr id)))
  -                       (symbol-value (intern (cdr id))))
  +                  (and (intern-soft (cdr id))
  +                       (bound-and-true-p (intern (cdr id))))
                     ;; Create a new object.
                     (make-multisession
                      :package (car id)


because `bound-and-true-p' is a macro that requires as argument a symbol, which (intern ...) is not.

ELISP> (bound-and-true-p (intern "whatever"))
*** Eval error ***  Wrong type argument: symbolp, (intern "whatever")

so I'm afraid this change was never tested.

The fix is reverting the change, doing perhaps this

diff --git a/lisp/emacs-lisp/multisession.el b/lisp/emacs-lisp/multisession.el
index 9d6e8c0d88..78d4137317 100644
--- a/lisp/emacs-lisp/multisession.el
+++ b/lisp/emacs-lisp/multisession.el
@@ -447,8 +447,9 @@ multisession-edit-value
   (let* ((object (or
                   ;; If the multisession variable already exists, use
                   ;; it (so that we update it).
-                  (and (intern-soft (cdr id))
-                       (bound-and-true-p (intern (cdr id))))
+                  (if-let (sym (intern-soft (cdr id)))
+                      (and (boundp sym) (symbol-value sym))
+                    nil)
                   ;; Create a new object.
                   (make-multisession
                    :package (car id)



--- End Message ---
--- Begin Message --- Subject: Re: bug#59710: Wrong type argument when editing a multisession variable Date: Fri, 2 Dec 2022 14:30:52 +0100


On Fri, Dec 2, 2022 at 2:07 PM Eli Zaretskii <eliz@gnu.org> wrote:

> This makes sense to me, so please go ahead and install (assuming that the
> multisession tests still all pass after this change).

Yes, they pass. Installed in commit e5b0141b0d of 2022-12-02.

BTW, I wonder if it would make sense to make bound-and-true-p to check that it gets a symbol:

diff --git i/lisp/bindings.el w/lisp/bindings.el
index c1ad5f7520..6ee730af58 100644
--- i/lisp/bindings.el
+++ w/lisp/bindings.el
@@ -671,4 +671,6 @@ bound-and-true-p
 Note that if `lexical-binding' is in effect, this function isn't
 meaningful if it refers to a lexically bound variable."
+  (unless (symbolp var)
+    (error "Wrong type argument: symbolp, %S" var))
   `(and (boundp (quote ,var)) ,var))
 



--- End Message ---

reply via email to

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