Re: what would cause failure in template for org capture?

2021-07-28 Thread Eric S Fraga
On Tuesday, 27 Jul 2021 at 12:37, No Wayman wrote:
> Resolved on Emacs master as of
> 949dd41c31dab69f7a5067bba324c28bb2cfbf8e

Excellent.  Re-building now!  Thank you (and Gregor) for bisecting and
reporting.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-598-g604bfd
: Latest paper written in org: https://arxiv.org/abs/2106.05096



Re: what would cause failure in template for org capture?

2021-07-27 Thread No Wayman



Thanks for doing the bisect.
I was in the process of doing it myself and comparing disassembled 
byte-code when I saw the patch had been pushed.
For anyone curious, this particular bug was a byte compilation 
error.
When byte-compiled, org-capture-fill-template was attempting to 
compare strings
via a jump-table-eq bytecode instruction instead of a 
jump-table-equal.


Resolved on Emacs master as of 
949dd41c31dab69f7a5067bba324c28bb2cfbf8e




Re: what would cause failure in template for org capture?

2021-07-27 Thread Gregor Zattler
Hi No, Eric,

* No Wayman  [2021-07-23; 23:03]:
>> from an earlier thread, I recall you mentioned you were using
>> native
>> compilation? This is almost certainly the cause of your problem.
>
> This does smell like a byte-compilation problem.
> Seems to be a failure with any interactive, single-character
> %-escaped patterns in a template string (e.g. %^g, %^C, %^t).
> I've narrowed it down to a call to pcase in
> `org-capture-fill-template'.
> As Eric mentions, the problem disappears if the function is
> re-evaluated/instrumented.
> I have disabled native compilation and the problem persists with
> just a freshly byte-compiled elc of org-capture.
> Tested this with the following recipe:
>
> 1. eval the following:
> (org-capture-fill-template "%^t") ;fails with `unrecognized
> template placeholder: %^t`
> 2. eval org-capture-fill-template's definition, and then re-eval
> the above. Works properly. User is prompted for a time.
> 3. byte compile org-capture-fill-template: (byte-compile
> #'org-capture-fill-template)
> 4. eval (org-capture-fill-template "%^t") ; error is back
>
>
> Running Emacs 28.0.50
> Repository revision: 903ecd7bea7d8f99a7dc84150728219283d79bf0
> Repository branch: master

this is now emacs bug 49746
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49746

Because of No's email I did a git bisect and found a commit
which changes the byte compiler.

Ciao; Gregor
--
 -... --- .-. . -.. ..--.. ...-.-




Re: what would cause failure in template for org capture?

2021-07-24 Thread Eric S Fraga
On Saturday, 24 Jul 2021 at 10:37, Tim Cross wrote:
> My advice would be not to use native compilation. 

Probably good advice but, for me, native compilation has (generally)
been working very well and has had significant performance
improvement.  I use Emacs as my window manager (EXWM) and every little
bit of speed helps.

Yes, there are some issues and org-capture may be one of them.  As you
say in another followup, this is probably an Emacs bug and not for org.

thank you,
eric

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-598-g604bfd
: Latest paper written in org: https://arxiv.org/abs/2106.05096



Re: what would cause failure in template for org capture?

2021-07-23 Thread Tim Cross


No Wayman  writes:

>> from an earlier thread, I recall you mentioned you were using native
>> compilation? This is almost certainly the cause of your problem.
>
> This does smell like a byte-compilation problem.
> Seems to be a failure with any interactive, single-character %-escaped 
> patterns
> in a template string (e.g. %^g, %^C, %^t).
> I've narrowed it down to a call to pcase in `org-capture-fill-template'.
> As Eric mentions, the problem disappears if the function is
> re-evaluated/instrumented.
> I have disabled native compilation and the problem persists with just a 
> freshly
> byte-compiled elc of org-capture.
> Tested this with the following recipe:
>
> 1. eval the following:
> (org-capture-fill-template "%^t") ;fails with `unrecognized template
> placeholder: %^t`
> 2. eval org-capture-fill-template's definition, and then re-eval the above.
> Works properly. User is prompted for a time.
> 3. byte compile org-capture-fill-template: (byte-compile
> #'org-capture-fill-template)
> 4. eval (org-capture-fill-template "%^t") ; error is back
>
>
> Running Emacs 28.0.50
> Repository revision: 903ecd7bea7d8f99a7dc84150728219283d79bf0
> Repository branch: master

Need to see if this can be reproduced in emacs 27.2. If it cannot, I
would suspect a bug in Emacs 28 and possibly something which should be
reported as an emacs bug (rather than an org bug).



Re: what would cause failure in template for org capture?

2021-07-23 Thread No Wayman



from an earlier thread, I recall you mentioned you were using 
native

compilation? This is almost certainly the cause of your problem.


This does smell like a byte-compilation problem.
Seems to be a failure with any interactive, single-character 
%-escaped patterns in a template string (e.g. %^g, %^C, %^t).
I've narrowed it down to a call to pcase in 
`org-capture-fill-template'.
As Eric mentions, the problem disappears if the function is 
re-evaluated/instrumented.
I have disabled native compilation and the problem persists with 
just a freshly byte-compiled elc of org-capture.

Tested this with the following recipe:

1. eval the following:
(org-capture-fill-template "%^t") ;fails with `unrecognized 
template placeholder: %^t`
2. eval org-capture-fill-template's definition, and then re-eval 
the above. Works properly. User is prompted for a time.
3. byte compile org-capture-fill-template: (byte-compile 
#'org-capture-fill-template)

4. eval (org-capture-fill-template "%^t") ; error is back


Running Emacs 28.0.50
Repository revision: 903ecd7bea7d8f99a7dc84150728219283d79bf0
Repository branch: master






Re: what would cause failure in template for org capture?

2021-07-23 Thread Tim Cross


Eric S Fraga  writes:

> On Wednesday, 21 Jul 2021 at 18:23, to...@tuxteam.de wrote:
>> So edebug fixed it? Good :-)
>
> Well, it fixed it until I started Emacs again (which I don't do often,
> luckily, as it's my window manager).  So, to get org-capture to work
> again, I need to instrument the function and then it works.  I have no
> idea how to debug this when it works just fine when instrumented.

Hi Eric,

from an earlier thread, I recall you mentioned you were using native
compilation? This is almost certainly the cause of your problem.

>From your description, I suspect that the compiled version of your code
is not complete and not loading correctly. This is why the problem is
solved when you try to use edebug on it as instrumenting the function
will result in the uncompiled *.el files being loaded. My advice would
be not to use native compilation. Native compilation is probably a good
advance for Emacs, but I think it is at least 18 months away from being
ready for prime time.

When running native compilation support, I found
- Absolutely no performance improvement
- Large packages with complex dependencies did not build correctly
- The native compilation caching scheme was unreliable and inconsistent

I would try re-building without native compilation and re-install org to
see if that fixes your problem.

Tim



Re: what would cause failure in template for org capture?

2021-07-23 Thread tomas
On Fri, Jul 23, 2021 at 03:41:49PM +0100, Eric S Fraga wrote:
> On Wednesday, 21 Jul 2021 at 18:23, to...@tuxteam.de wrote:
> > So edebug fixed it? Good :-)
> 
> Well, it fixed it until I started Emacs again

Gah. Sorry to hear that :-(

Cheers
 - t


signature.asc
Description: Digital signature


Re: what would cause failure in template for org capture?

2021-07-23 Thread Eric S Fraga
On Wednesday, 21 Jul 2021 at 18:23, to...@tuxteam.de wrote:
> So edebug fixed it? Good :-)

Well, it fixed it until I started Emacs again (which I don't do often,
luckily, as it's my window manager).  So, to get org-capture to work
again, I need to instrument the function and then it works.  I have no
idea how to debug this when it works just fine when instrumented.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-598-g604bfd
: Latest paper written in org: https://arxiv.org/abs/2106.05096



Re: what would cause failure in template for org capture?

2021-07-21 Thread tomas
On Wed, Jul 21, 2021 at 04:38:58PM +0100, Eric S Fraga wrote:
> u figured why not learn edebug *now*.
> 
> so I instrument that method, start the capture, tell edebug to go when
> it stops in that function, and the capture works.  And now it works
> whether instrumented or not.  Hey hum.  A total mystery but at least it
> works.

So edebug fixed it? Good :-)

(Now I'm hiding again under my stone ;-)

Cheers
 - t


signature.asc
Description: Digital signature


Re: what would cause failure in template for org capture?

2021-07-21 Thread Eric S Fraga
u figured why not learn edebug *now*.

so I instrument that method, start the capture, tell edebug to go when
it stops in that function, and the capture works.  And now it works
whether instrumented or not.  Hey hum.  A total mystery but at least it
works.

Maybe native compilation has something to do with this?  This is me
grasping at straws, mind you.

I'll update if/when this problem re-asserts itself.

Thanks again,
eric

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-598-g604bfd
: Latest paper written in org: https://arxiv.org/abs/2106.05096



Re: what would cause failure in template for org capture?

2021-07-21 Thread Eric S Fraga
On Wednesday, 21 Jul 2021 at 11:21, Nick Dokos wrote:
> FWIW, it's working for me. There was a change on July 8 having to do
> with tags completion (using completing-read-multiple), 

which kind of supports my suspicion that it has to do with
selectrum. :-(

> I would probably edebug `org-capture-fille-template` and check that the
> code around l.1733 in `org-capture.el' behaves as expected.

Yet another reason for me to learn edebug finally...  I'll see if I can
find some time.

Thank you,
eric

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-598-g604bfd
: Latest paper written in org: https://arxiv.org/abs/2106.05096



Re: what would cause failure in template for org capture?

2021-07-21 Thread Nick Dokos
Eric S Fraga  writes:

> Hello all,
>
> I am getting this error message:
>
> org-capture: Capture abort: Unknown template placeholder: "%^G"
>
> when attempting to capture a task using this template:
>
> #+begin_src emacs-lisp
>   (add-to-list 'org-capture-templates
>'("t"
>  "todo"
>  entry (file+headline "~/s/notes/todo.org" "refile")
>  "* %^{Task}   %^G\n%i%?\n%U\n"))
> #+end_src
>
> The error happens after having entered the information for the Task in
> the template so next would be the tags.
>
> This was working until recently.  Both Emacs and org are up to date
> relative to their git repositories.  The only change done recently in my
> configuration is a move from ivy to selectrum for completion.

FWIW, it's working for me. There was a change on July 8 having to do
with tags completion (using completing-read-multiple), but I'm running
with that change and I don't see a problem. OTOH, I'm not using
selectrum (or ivy for that matter), so the change may be interacting
badly with it.

I would probably edebug `org-capture-fille-template` and check that the
code around l.1733 in `org-capture.el' behaves as expected.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




what would cause failure in template for org capture?

2021-07-21 Thread Eric S Fraga
Hello all,

I am getting this error message:

org-capture: Capture abort: Unknown template placeholder: "%^G"

when attempting to capture a task using this template:

#+begin_src emacs-lisp
  (add-to-list 'org-capture-templates
   '("t"
 "todo"
 entry (file+headline "~/s/notes/todo.org" "refile")
 "* %^{Task}   %^G\n%i%?\n%U\n"))
#+end_src

The error happens after having entered the information for the Task in
the template so next would be the tags.

This was working until recently.  Both Emacs and org are up to date
relative to their git repositories.  The only change done recently in my
configuration is a move from ivy to selectrum for completion.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-598-g604bfd
: Latest paper written in org: https://arxiv.org/abs/2106.05096