1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 22:41:06 -08:00

Add macro pcase-lambda

Fixes: debbugs:19814

* emacs-lisp/lisp-mode.el (el-kws-re): Include `pcase-lambda'.

* emacs-lisp/macroexp.el (macroexp-parse-body): New function.

* emacs-lisp/pcase.el (pcase-lambda): New Macro.
This commit is contained in:
Leo Liu 2015-02-09 10:05:44 +08:00
parent fd6f7d1449
commit 751adc4b96
4 changed files with 39 additions and 1 deletions

View file

@ -297,6 +297,16 @@ definitions to shadow the loaded ones for use in file byte-compilation."
;;; Handy functions to use in macros.
(defun macroexp-parse-body (exps)
"Parse EXPS into ((DOC DECLARE-FORM INTERACTIVE-FORM) . BODY)."
`((,(and (stringp (car exps))
(pop exps))
,(and (eq (car-safe (car exps)) 'declare)
(pop exps))
,(and (eq (car-safe (car exps)) 'interactive)
(pop exps)))
,@exps))
(defun macroexp-progn (exps)
"Return an expression equivalent to `(progn ,@EXPS)."
(if (cdr exps) `(progn ,@exps) (car exps)))