GNU bug report logs - #16201
24.3.50; error expanding pcase with a pred clause

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Fri, 20 Dec 2013 14:47:02 UTC

Severity: normal

Found in version 24.3.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16201 in the body.
You can then email your comments to 16201 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#16201; Package emacs. (Fri, 20 Dec 2013 14:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Heerdegen <michael_heerdegen <at> web.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 20 Dec 2013 14:47:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; error expanding pcase with a pred clause
Date: Fri, 20 Dec 2013 15:45:10 +0100
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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16201; Package emacs. (Sat, 21 Dec 2013 11:56:01 GMT) Full text and rfc822 format available.

Message #8 received at 16201 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: 16201 <at> debbugs.gnu.org
Subject: Re: bug#16201: 24.3.50; error expanding pcase with a pred clause
Date: Sat, 21 Dec 2013 12:54:21 +0100
Michael Heerdegen <michael_heerdegen <at> 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.




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Fri, 03 Jan 2014 04:42:01 GMT) Full text and rfc822 format available.

Notification sent to Michael Heerdegen <michael_heerdegen <at> web.de>:
bug acknowledged by developer. (Fri, 03 Jan 2014 04:42:02 GMT) Full text and rfc822 format available.

Message #13 received at 16201-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 16201-done <at> debbugs.gnu.org
Subject: Re: bug#16201: 24.3.50; error expanding pcase with a pred clause
Date: Thu, 02 Jan 2014 23:41:03 -0500
> 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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 31 Jan 2014 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 144 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.