unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49739: 28.0.50; byte-compiled pcase pattern match failure
@ 2021-07-26  3:33 No Wayman
  2021-07-26 22:26 ` Michael Heerdegen
  2021-07-27 17:10 ` Mattias Engdegård
  0 siblings, 2 replies; 3+ messages in thread
From: No Wayman @ 2021-07-26  3:33 UTC (permalink / raw)
  To: 49739


Recently a user reported a bug on Org-mode's mailing list in which 
an org-capture template was failing to fill properly:

https://orgmode.org/list/87fsw3zyjl.fsf@ucl.ac.uk/T/#t

I was able to reproduce the issue with emacs -Q and the following 
recipe:

Evaluate the following in *scratch*:

(progn
  (require 'org-capture)
  (org-capture-fill-template "%^t"))

This should prompt the user for a time, instead we hit the `_` 
case in one of the pcase calls in `org-capture-fill-template' 
despite the valid template string. This results in the error:

"unrecognized template placeholder: %^t"

I've observed that this only occurs when 
`org-capture-fill-template' has been byte-compiled.
Re-evaluating the defun results in the expected behavior. And 
byte-compiling the function puts us back in the erroneous state:

(progn
  (byte-compile #'org-capture-fill-template)
  (org-capture-fill-template "%^t")) ; unrecognized template 
  placeholder...

I didn't do a proper git-bisect, but the everything works as 
expected when building from the parent 
(3af2cee64b86e4ce59adb8e8720d92db35039cbc) of the following 
commit:

commit 937b6c18bd6c4806eb1e4c8764db56b314c09056
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Date:   Fri Mar 19 17:42:22 2021 -0400

    * lisp/emacs-lisp/pcase.el (pcase-compile-patterns): New 
    function (bug#47261)
    
    Extracted from `pcase--expand`.
    (pcase--expand): Use it.

I tried to do some more debugging, but I'm not familiar with how 
to debug a problem which only crops up in byte-compiled elisp. 
Happy to provide any other information if necessary.

~ Nick





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#49739: 28.0.50; byte-compiled pcase pattern match failure
  2021-07-26  3:33 bug#49739: 28.0.50; byte-compiled pcase pattern match failure No Wayman
@ 2021-07-26 22:26 ` Michael Heerdegen
  2021-07-27 17:10 ` Mattias Engdegård
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Heerdegen @ 2021-07-26 22:26 UTC (permalink / raw)
  To: No Wayman; +Cc: 49739

No Wayman <iarchivedmywholelife@gmail.com> writes:

> (progn
>  (require 'org-capture)
>  (org-capture-fill-template "%^t"))
>
> This should prompt the user for a time, instead we hit the `_` case in
> one of the pcase calls in `org-capture-fill-template' despite the
> valid template string. This results in the error:
>
> "unrecognized template placeholder: %^t"

That works for me.  Are there any other requirements, a natively
compiled Emacs or so?

Or maybe "make bootstrap" (i.e. building Emacs from scratch) helps?

If not, are you able to provide a test case?  AFAIU the `pcase' call
causing the trouble fails to compare strings correctly.

If you compile and load a function like

(defun test (string)
  (pcase string
    ("a" 1)
    (_ nil)))

does that work as expected?


TIA,

Michael.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#49739: 28.0.50; byte-compiled pcase pattern match failure
  2021-07-26  3:33 bug#49739: 28.0.50; byte-compiled pcase pattern match failure No Wayman
  2021-07-26 22:26 ` Michael Heerdegen
@ 2021-07-27 17:10 ` Mattias Engdegård
  1 sibling, 0 replies; 3+ messages in thread
From: Mattias Engdegård @ 2021-07-27 17:10 UTC (permalink / raw)
  To: 49739-done

Fixed on master.






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-27 17:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26  3:33 bug#49739: 28.0.50; byte-compiled pcase pattern match failure No Wayman
2021-07-26 22:26 ` Michael Heerdegen
2021-07-27 17:10 ` Mattias Engdegård

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).