summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorMichael Heerdegen <michael_heerdegen@web.de>2018-06-13 04:37:38 +0200
committerMichael Heerdegen <michael_heerdegen@web.de>2018-06-17 15:22:30 +0200
commit45ee24efed57093b421159ca1028097952f2d564 (patch)
treef6172378d6be486b5ec339d3363a632877970108 /lisp/emacs-lisp
parentfa9679ca488a17b2b6b9f31299d69c190aa86642 (diff)
downloademacs-45ee24efed57093b421159ca1028097952f2d564.tar.gz
emacs-45ee24efed57093b421159ca1028097952f2d564.tar.bz2
emacs-45ee24efed57093b421159ca1028097952f2d564.zip
Allow floats as 'pcase' QPATS
* lisp/emacs-lisp/pcase.el (\`): Extend semantics of QPATS to all numbers. Add a comment explaining why we disallow some atoms as QPATS. * doc/lispref/control.texi (Backquote Patterns): Update the paragraph explaining QPATS. Remove a sentence suggesting an analogy between QPATS to self-quoting objects.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/pcase.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index fa7b1de8b4d..4a69244d265 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -919,7 +919,7 @@ QPAT can take the following forms:
,PAT matches if the `pcase' pattern PAT matches.
SYMBOL matches if EXPVAL is `equal' to SYMBOL.
KEYWORD likewise for KEYWORD.
- INTEGER likewise for INTEGER.
+ NUMBER likewise for NUMBER.
STRING likewise for STRING.
The list or vector QPAT is a template. The predicate formed
@@ -949,7 +949,10 @@ The predicate is the logical-AND of:
`(and (pred consp)
(app car ,(list '\` (car qpat)))
(app cdr ,(list '\` (cdr qpat)))))
- ((or (stringp qpat) (integerp qpat) (symbolp qpat)) `',qpat)
+ ((or (stringp qpat) (numberp qpat) (symbolp qpat)) `',qpat)
+ ;; In all other cases just raise an error so we can't break
+ ;; backward compatibility when adding \` support for other
+ ;; compounded values that are not `consp'
(t (error "Unknown QPAT: %S" qpat))))
(provide 'pcase)