diff options
| author | Nicolas Petton | 2019-03-22 10:06:42 +0100 |
|---|---|---|
| committer | Nicolas Petton | 2019-03-22 10:31:23 +0100 |
| commit | 4174409c53d85a0def138f92d3e71901380c907a (patch) | |
| tree | c9ad7741513698430a6993982cf2c1cf274656d3 | |
| parent | 09c220a5cfb229ef88d1b3e9065951e3368da1e2 (diff) | |
| download | emacs-4174409c53d85a0def138f92d3e71901380c907a.tar.gz emacs-4174409c53d85a0def138f92d3e71901380c907a.zip | |
Fix the error message when modifying maps in-place (Bug#34941)
* 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.
| -rw-r--r-- | lisp/emacs-lisp/map.el | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index f4fff334b9e..9a86736fba1 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el | |||
| @@ -96,7 +96,7 @@ Returns the result of evaluating the form associated with MAP-VAR's type." | |||
| 96 | (t (error "Unsupported map type `%S': %S" | 96 | (t (error "Unsupported map type `%S': %S" |
| 97 | (type-of ,map-var) ,map-var))))) | 97 | (type-of ,map-var) ,map-var))))) |
| 98 | 98 | ||
| 99 | (define-error 'map-not-inplace "Cannot modify map in-place: %S") | 99 | (define-error 'map-not-inplace "Cannot modify map in-place") |
| 100 | 100 | ||
| 101 | (defsubst map--plist-p (list) | 101 | (defsubst map--plist-p (list) |
| 102 | (and (consp list) (not (listp (car list))))) | 102 | (and (consp list) (not (listp (car list))))) |
| @@ -393,7 +393,7 @@ If you want to insert an element without modifying MAP, use `map-insert'." | |||
| 393 | (let ((oldmap map)) | 393 | (let ((oldmap map)) |
| 394 | (setf (alist-get key map key nil (or testfn #'equal)) value) | 394 | (setf (alist-get key map key nil (or testfn #'equal)) value) |
| 395 | (unless (eq oldmap map) | 395 | (unless (eq oldmap map) |
| 396 | (signal 'map-not-inplace (list map))))) | 396 | (signal 'map-not-inplace (list oldmap))))) |
| 397 | :hash-table (puthash key value map) | 397 | :hash-table (puthash key value map) |
| 398 | ;; FIXME: If `key' is too large, should we signal `map-not-inplace' | 398 | ;; FIXME: If `key' is too large, should we signal `map-not-inplace' |
| 399 | ;; and let `map-insert' grow the array? | 399 | ;; and let `map-insert' grow the array? |