diff options
Diffstat (limited to 'lisp/emacs-lisp')
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 8 | ||||
| -rw-r--r-- | lisp/emacs-lisp/map.el | 17 | ||||
| -rw-r--r-- | lisp/emacs-lisp/pcase.el | 6 |
3 files changed, 17 insertions, 14 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 9fe6e036fbd..11eb44cea31 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1169,7 +1169,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (display-warning 'bytecomp string level byte-compile-log-buffer))) (defun byte-compile-warn (format &rest args) - "Issue a byte compiler warning; use (format FORMAT ARGS...) for message." + "Issue a byte compiler warning; use (format-message FORMAT ARGS...) for message." (setq format (apply #'format-message format args)) (if byte-compile-error-on-warn (error "%s" format) ; byte-compile-file catches and logs it @@ -3748,7 +3748,8 @@ discarding." (if (= (logand len 1) 1) (progn (byte-compile-log-warning - (format "missing value for `%S' at end of setq" (car (last args))) + (format-message + "missing value for `%S' at end of setq" (car (last args))) nil :error) (byte-compile-form `(signal 'wrong-number-of-arguments '(setq ,len)) @@ -4019,7 +4020,8 @@ that suppresses all warnings during execution of BODY." (progn (mapc 'byte-compile-form (cdr form)) (byte-compile-out 'byte-call (length (cdr (cdr form))))) - (byte-compile-log-warning "`funcall' called with no arguments" nil :error) + (byte-compile-log-warning + (format-message "`funcall' called with no arguments") nil :error) (byte-compile-form '(signal 'wrong-number-of-arguments '(funcall 0)) byte-compile--for-effect))) diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index ebef27185ae..ec8d3d79d9f 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el @@ -47,17 +47,18 @@ (pcase-defmacro map (&rest args) "Build a `pcase' pattern matching map elements. -The `pcase' pattern will match each element of PATTERN against -the corresponding elements of the map. +ARGS is a list of elements to be matched in the map. -Extra elements of the map are ignored if fewer ARGS are -given, and the match does not fail. +Each element of ARGS can be of the form (KEY PAT), in which case KEY is +evaluated and searched for in the map. The match fails if for any KEY +found in the map, the corresponding PAT doesn't match the value +associated to the KEY. -ARGS can be a list of the form (KEY PAT), in which case KEY in an -unquoted form. +Each element can also be a SYMBOL, which is an abbreviation of a (KEY +PAT) tuple of the form (\\='SYMBOL SYMBOL). -ARGS can also be a list of symbols, which stands for ('SYMBOL -SYMBOL)." +Keys in ARGS not found in the map are ignored, and the match doesn't +fail." `(and (pred mapp) ,@(map--make-pcase-bindings args))) diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 7be997e6469..7e164c0fe5c 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -111,7 +111,7 @@ CASES is a list of elements of the form (PATTERN CODE...). A structural PATTERN describes a template that identifies a class -of values. For example, the pattern `(,foo ,bar) matches any +of values. For example, the pattern \\=`(,foo ,bar) matches any two element list, binding its elements to symbols named `foo' and `bar' -- in much the same way that `cl-destructuring-bind' would. @@ -119,12 +119,12 @@ A significant difference from `cl-destructuring-bind' is that, if a pattern match fails, the next case is tried until either a successful match is found or there are no more cases. -Another difference is that pattern elements may be backquoted, +Another difference is that pattern elements may be quoted, meaning they must match exactly: The pattern \\='(foo bar) matches only against two element lists containing the symbols `foo' and `bar' in that order. (As a short-hand, atoms always match themselves, such as numbers or strings, and need not be -quoted). +quoted.) Lastly, a pattern can be logical, such as (pred numberp), that matches any number-like element; or the symbol `_', that matches |
