Subject: bug#49739: closed (Re: bug#49739: 28.0.50; byte-compiled pcase pattern match failure)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 27 Jul 2021 17:11:02 +0000

Your bug report

#49739: 28.0.50; byte-compiled pcase pattern match failure

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
49739: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=49739
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#49739: 28.0.50; byte-compiled pcase pattern match failure
From: Mattias Engdegård <[email-masked]>
To: [email-masked]
Date: Tue, 27 Jul 2021 19:10:46 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Fixed on master.

Subject: 28.0.50; byte-compiled pcase pattern match failure
From: No Wayman <[email-masked]>
To: [email-masked]
Date: Sun, 25 Jul 2021 23:33:39 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

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/[email-masked]/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 <[email-masked]>
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