GNU bug report logs - #59710
Wrong type argument when editing a multisession variable

Previous Next

Package: emacs;

Reported by: Juanma Barranquero <lekktu <at> gmail.com>

Date: Wed, 30 Nov 2022 01:51:02 UTC

Severity: normal

Found in version 29.0.60

Done: Juanma Barranquero <lekktu <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juanma Barranquero <lekktu <at> gmail.com>
To: 59710 <at> debbugs.gnu.org
Cc: "lars ingebrigtsen" <larsi <at> gnus.org>
Subject: bug#59710: Wrong type argument when editing a multisession variable
Date: Wed, 30 Nov 2022 02:49:15 +0100
[Message part 1 (text/plain, inline)]
Package: emacs
Version: 29.0.60
Severity: normal
X-Debbugs-Cc: "Lars Ingebrigtsen" <larsi <at> 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 <at> 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)
[Message part 2 (text/html, inline)]

This bug report was last modified 2 years and 227 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.