]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix the error message when modifying maps in-place (Bug#34941)
authorNicolas Petton <nicolas@petton.fr>
Fri, 22 Mar 2019 09:06:42 +0000 (10:06 +0100)
committerNicolas Petton <nicolas@petton.fr>
Fri, 22 Mar 2019 09:31:23 +0000 (10:31 +0100)
* lisp/emacs-lisp/map.el (map-not-inplace): Fix the message of the
error.
(map-put!): When signaling map-no-inplace error, output the map that
cannot be updated inplace.

lisp/emacs-lisp/map.el

index f4fff334b9ec0ca2925379ecbba7da2f3b0a6328..9a86736fba10e2479c5bf66fb14e8bbd22b70663 100644 (file)
@@ -96,7 +96,7 @@ Returns the result of evaluating the form associated with MAP-VAR's type."
            (t (error "Unsupported map type `%S': %S"
                      (type-of ,map-var) ,map-var)))))
 
-(define-error 'map-not-inplace "Cannot modify map in-place: %S")
+(define-error 'map-not-inplace "Cannot modify map in-place")
 
 (defsubst map--plist-p (list)
   (and (consp list) (not (listp (car list)))))
@@ -393,7 +393,7 @@ If you want to insert an element without modifying MAP, use `map-insert'."
       (let ((oldmap map))
         (setf (alist-get key map key nil (or testfn #'equal)) value)
         (unless (eq oldmap map)
-          (signal 'map-not-inplace (list map)))))
+          (signal 'map-not-inplace (list oldmap)))))
     :hash-table (puthash key value map)
     ;; FIXME: If `key' is too large, should we signal `map-not-inplace'
     ;; and let `map-insert' grow the array?