[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#14935: 24.3.50; pcase (or) UPAT fails?
From: |
Vitalie Spinu |
Subject: |
bug#14935: 24.3.50; pcase (or) UPAT fails? |
Date: |
Wed, 24 Jul 2013 09:19:19 +0200 |
User-agent: |
Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) |
Thanks, it works. And more complex patterns are also fine now:
(pcase (list 23 nil "%")
(`(,x nil ,(or "^" "%")) (message "%s" x)))
>> Stefan Monnier <monnier@iro.umontreal.ca>
>> on Wed, 24 Jul 2013 01:14:10 -0400 wrote:
>> (pcase "^"
>> ((or "^" "%") (message "here")))
> Yes, this should work, but it incorrectly used `memq' whereas the (or
> `"^" `"%") pattern correctly leads to the use of `member'.
> I installed the patch below which should fix it,
> Stefan
> === modified file 'lisp/emacs-lisp/pcase.el'
> --- lisp/emacs-lisp/pcase.el 2013-07-08 21:54:54 +0000
> +++ lisp/emacs-lisp/pcase.el 2013-07-24 05:10:31 +0000
> @@ -659,7 +659,11 @@
> (memq-fine t))
> (when all
> (dolist (alt (cdr upat))
> - (unless (or (pcase--self-quoting-p alt)
> + (unless (if (pcase--self-quoting-p alt)
> + (progn
> + (unless (or (symbolp alt) (integerp alt))
> + (setq memq-fine nil))
> + t)
> (and (eq (car-safe alt) '\`)
> (or (symbolp (cadr alt)) (integerp (cadr
> alt))
> (setq memq-fine nil)