Commit 85b3d352 authored by Leo Liu's avatar Leo Liu
Browse files

* emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2): Add


* emacs-lisp/pcase.el (pcase--dontwarn-upats): New var.
(pcase--expand): Use it.
(pcase-exhaustive): New macro.

Fixes: debbugs:16567
parent 4d837e51
2014-09-13 Leo Liu <>
* emacs-lisp/pcase.el (pcase--dontwarn-upats): New var.
(pcase--expand): Use it.
(pcase-exhaustive): New macro. (Bug#16567)
* emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2): Add
2014-09-13 Eli Zaretskii <>
* mail/rmailmm.el (rmail-mime-insert-html): Decode the HTML part
......@@ -197,9 +197,9 @@ It has `lisp-mode-abbrev-table' as its parent."
(el-vdefs '("defconst" "defcustom" "defvaralias" "defvar-local"
(el-tdefs '("defgroup" "deftheme"))
(el-kw '("while-no-input" "letrec" "pcase" "pcase-let"
"pcase-let*" "save-restriction" "save-excursion"
(el-kw '("while-no-input" "letrec" "pcase" "pcase-exhaustive"
"pcase-let" "pcase-let*" "save-restriction"
"save-excursion" "save-selected-window"
;; "eval-after-load" "eval-next-after-load"
"save-window-excursion" "save-current-buffer"
"save-match-data" "combine-after-change-calls"
......@@ -68,6 +68,8 @@
(defconst pcase--dontcare-upats '(t _ pcase--dontcare))
(defvar pcase--dontwarn-upats '(pcase--dontcare))
(&or symbolp
......@@ -148,6 +150,15 @@ like `(,a . ,(pred (< a))) or, with more checks:
;; (puthash (car cases) `(,exp ,cases ,@expansion) pcase--memoize-2)
(defmacro pcase-exhaustive (exp &rest cases)
"The exhaustive version of `pcase' (which see)."
(declare (indent 1) (debug pcase))
(let* ((x (make-symbol "x"))
(pcase--dontwarn-upats (cons x pcase--dontwarn-upats)))
exp (append cases `((,x (error "No clause matching `%S'" ,x)))))))
(defun pcase--let* (bindings body)
((null bindings) (macroexp-progn body))
......@@ -280,7 +291,8 @@ of the form (UPAT EXP)."
(dolist (case cases)
(unless (or (memq case used-cases) (eq (car case) 'pcase--dontcare))
(unless (or (memq case used-cases)
(memq (car case) pcase--dontwarn-upats))
(message "Redundant pcase pattern: %S" (car case))))
(macroexp-let* defs main))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment