* bug#16201: 24.3.50; error expanding pcase with a pred clause
@ 2013-12-20 14:45 Michael Heerdegen
2013-12-21 11:54 ` Michael Heerdegen
2014-01-03 4:41 ` Stefan Monnier
0 siblings, 2 replies; 3+ messages in thread
From: Michael Heerdegen @ 2013-12-20 14:45 UTC (permalink / raw)
To: 16201
Hi,
sorry if this is a known issue.
In emacs -Q (current trunk), save the following snipped
--8<---------------cut here---------------start------------->8---
(require 'pcase)
(defun test-buffer-file-name ()
(pcase buffer-file-name
(`nil 'not-a-file)
((pred file-writable-p) 'writable)
(_ 'not-writable)))
--8<---------------cut here---------------end--------------->8---
into a file. Then, M-: (byte-compile-file buffer-file-name). You get
an error:
pcase-bug.el:3:1:Error: Wrong type argument: stringp, nil
Same with C-x C-e with point after the defun.
BTW, (require 'pcase) is necessary in the recipe. If pcase has not yet
been loaded, the error doesn't happen. Instead you can compile or eval
the defun (once), and it works as expected!
Thanks,
Michael.
In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.8.4)
of 2013-12-20 on drachen
Windowing system distributor `The X.Org Foundation', version 11.0.11403000
System Description: Debian GNU/Linux testing (jessie)
Configured using:
`configure --prefix=/usr/local/built/'
Important settings:
value of $LC_ALL: de_DE.utf8
value of $LC_COLLATE: C
value of $LC_TIME: C
value of $LANG: de_DE.utf8
locale-coding-system: utf-8-unix
Major mode: Emacs-Lisp
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#16201: 24.3.50; error expanding pcase with a pred clause
2013-12-20 14:45 bug#16201: 24.3.50; error expanding pcase with a pred clause Michael Heerdegen
@ 2013-12-21 11:54 ` Michael Heerdegen
2014-01-03 4:41 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Michael Heerdegen @ 2013-12-21 11:54 UTC (permalink / raw)
To: 16201
Michael Heerdegen <michael_heerdegen@web.de> writes:
> (defun test-buffer-file-name ()
> (pcase buffer-file-name
> (`nil 'not-a-file)
> ((pred file-writable-p) 'writable)
> (_ 'not-writable)))
>
> pcase-bug.el:3:1:Error: Wrong type argument: stringp, nil
pcase seems to test whether the constant (nil) from the first clause
fulfills the pred of the second clause. Which is not legal in this
case.
I thought this could be ok:
(pcase buffer-file-name
(`nil 'not-a-file)
((and (pred stringp)
(pred file-writable-p)) 'writable)
(_ 'not-writable))
but that triggers the same error.
This works, however, but doesn't look so nice:
(pcase buffer-file-name
(`nil 'not-a-file)
((pred (lambda (x) (and (stringp x) (file-writable-p x)))) 'writable)
(_ 'not-writable))
Regards,
Michael.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#16201: 24.3.50; error expanding pcase with a pred clause
2013-12-20 14:45 bug#16201: 24.3.50; error expanding pcase with a pred clause Michael Heerdegen
2013-12-21 11:54 ` Michael Heerdegen
@ 2014-01-03 4:41 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2014-01-03 4:41 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 16201-done
> sorry if this is a known issue.
It wasn't, thank you.
> pcase-bug.el:3:1:Error: Wrong type argument: stringp, nil
Should be fixed now, thank you,
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-03 4:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-20 14:45 bug#16201: 24.3.50; error expanding pcase with a pred clause Michael Heerdegen
2013-12-21 11:54 ` Michael Heerdegen
2014-01-03 4:41 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.