I have run into a problem in implementing a "select-style" function for an org-cite-insert-processor. The WIP code is here: https://github.com/bdarcus/bibtex-actions/pull/182 It was running correctly yesterday morning, but now it doesn't. I have two related issues: 1. I think, but am not sure, I may have run into a bug in org-cite-make-insert-processor, as the function I am using for the select-style parameter runs correctly outside of the insert processor, and returns the same results as the "org-cite-basic--complete-style" function. But when I uncomment the parameter to use it on the org-cite insert processor, it not only doesn't work correctly, but Emacs won't even load fully. 2. The error I get "wrong type" is so general it literally took me hours to realize it was coming from this function; I was looking elsewhere for the issue. So if I'm right about a bug, obviously it would be great if that could be fixed. But better error handling and reporting would also be really great. Bruce PS - I"m still learning elisp, and so am not super knowledgeable about debugging in general. If anyone has any tips on that, that could help me narrow down the source of the error, that would be much appreciated.
BTW, here's the info from the debugger:
Debugger entered--Lisp error: (error "Wrong argument type(s)")
error("Wrong argument type(s)")
org-cite-make-insert-processor(bibtex-actions-org-cite-insert
bibtex-actions-org-cite-select-style)
(org-cite-register-processor 'bibtex-actions-org-cite
:insert (org-cite-make-insert-processor
#'bibtex-actions-org-cite-insert
#'bibtex-actions-org-cite-select-style)
:follow #'bibtex-actions-org-cite-follow)
load-with-code-conversion("/home/bruce/.config/emacs/.local/straight/build-28..."
"/home/bruce/.config/emacs/.local/straight/build-28..." nil t)
require(bibtex-actions-org-cite nil nil)
On Wed, Jul 21, 2021 at 11:14 AM Bruce D'Arcus <bdarcus@gmail.com> wrote:
>
> I have run into a problem in implementing a "select-style" function
> for an org-cite-insert-processor.
>
> The WIP code is here:
>
> https://github.com/bdarcus/bibtex-actions/pull/182
>
> It was running correctly yesterday morning, but now it doesn't.
>
> I have two related issues:
>
> 1. I think, but am not sure, I may have run into a bug in
> org-cite-make-insert-processor, as the function I am using for the
> select-style parameter runs correctly outside of the insert processor,
> and returns the same results as the "org-cite-basic--complete-style"
> function. But when I uncomment the parameter to use it on the org-cite
> insert processor, it not only doesn't work correctly, but Emacs won't
> even load fully.
>
> 2. The error I get "wrong type" is so general it literally took me
> hours to realize it was coming from this function; I was looking
> elsewhere for the issue.
>
> So if I'm right about a bug, obviously it would be great if that could be fixed.
>
> But better error handling and reporting would also be really great.
>
> Bruce
>
> PS - I"m still learning elisp, and so am not super knowledgeable about
> debugging in general. If anyone has any tips on that, that could help
> me narrow down the source of the error, that would be much
> appreciated.
Another odd thing.
If I comment out those lines and use the oc-basic style selector
instead to start emacs, and from there reactivate this function and
compile and reload the code from the buffer, THEN it works without
error.
On Wed, Jul 21, 2021 at 10:17 PM Bruce D'Arcus <bdarcus@gmail.com> wrote:
>
> BTW, here's the info from the debugger:
>
> Debugger entered--Lisp error: (error "Wrong argument type(s)")
> error("Wrong argument type(s)")
> org-cite-make-insert-processor(bibtex-actions-org-cite-insert
> bibtex-actions-org-cite-select-style)
> (org-cite-register-processor 'bibtex-actions-org-cite
> :insert (org-cite-make-insert-processor
> #'bibtex-actions-org-cite-insert
> #'bibtex-actions-org-cite-select-style)
> :follow #'bibtex-actions-org-cite-follow)
> load-with-code-conversion("/home/bruce/.config/emacs/.local/straight/build-28..."
> "/home/bruce/.config/emacs/.local/straight/build-28..." nil t)
> require(bibtex-actions-org-cite nil nil)
>
> On Wed, Jul 21, 2021 at 11:14 AM Bruce D'Arcus <bdarcus@gmail.com> wrote:
> >
> > I have run into a problem in implementing a "select-style" function
> > for an org-cite-insert-processor.
> >
> > The WIP code is here:
> >
> > https://github.com/bdarcus/bibtex-actions/pull/182
> >
> > It was running correctly yesterday morning, but now it doesn't.
> >
> > I have two related issues:
> >
> > 1. I think, but am not sure, I may have run into a bug in
> > org-cite-make-insert-processor, as the function I am using for the
> > select-style parameter runs correctly outside of the insert processor,
> > and returns the same results as the "org-cite-basic--complete-style"
> > function. But when I uncomment the parameter to use it on the org-cite
> > insert processor, it not only doesn't work correctly, but Emacs won't
> > even load fully.
> >
> > 2. The error I get "wrong type" is so general it literally took me
> > hours to realize it was coming from this function; I was looking
> > elsewhere for the issue.
> >
> > So if I'm right about a bug, obviously it would be great if that could be fixed.
> >
> > But better error handling and reporting would also be really great.
> >
> > Bruce
> >
> > PS - I"m still learning elisp, and so am not super knowledgeable about
> > debugging in general. If anyone has any tips on that, that could help
> > me narrow down the source of the error, that would be much
> > appreciated.
The problem was load order I guess; putting this of the file fixes it.
So when org-citemake-insert-processor is first loaded, it looks for
the two functions, which haven't been loaded yet.
I still think a) the error message could say that (that the functions
aren't found or some such), and b) that it shouldn't break starting
Emacs.
On Thu, Jul 22, 2021 at 4:27 AM Bruce D'Arcus <bdarcus@gmail.com> wrote:
> If I comment out those lines and use the oc-basic style selector
> instead to start emacs, and from there reactivate this function and
> compile and reload the code from the buffer, THEN it works without
> error.
[-- Attachment #1: Type: text/plain, Size: 1054 bytes --] Bruce, are you loading this code with use-package? If so, and if I'm reading this right, you can perhaps add the missing functions to the :commands directive for org-mode? IIUC that should ensure that they are available to your package, as long as you have an :after (org oc) line in the package's use-package directive. On Thu, Jul 22, 2021 at 6:31 AM Bruce D'Arcus <bdarcus@gmail.com> wrote: > The problem was load order I guess; putting this of the file fixes it. > > So when org-citemake-insert-processor is first loaded, it looks for > the two functions, which haven't been loaded yet. > > I still think a) the error message could say that (that the functions > aren't found or some such), and b) that it shouldn't break starting > Emacs. > > On Thu, Jul 22, 2021 at 4:27 AM Bruce D'Arcus <bdarcus@gmail.com> wrote: > > > If I comment out those lines and use the oc-basic style selector > > instead to start emacs, and from there reactivate this function and > > compile and reload the code from the buffer, THEN it works without > > error. > > [-- Attachment #2: Type: text/html, Size: 1570 bytes --]
Matt - that's not really the problem.
In general, these core org-cite functions
(org-cite-make-insert-processor and org-cite-register-processor) must
be loaded after anything they refer to; e.g. placed at the end of the
package file.
But if they aren't, the resulting error message is really confusing,
and emacs shouldn't break.
On Thu, Jul 22, 2021 at 9:27 AM Matt Price <moptop99@gmail.com> wrote:
>
> Bruce, are you loading this code with use-package? If so, and if I'm reading this right, you can perhaps add the missing functions to the
>
> :commands
>
> directive for org-mode? IIUC that should ensure that they are available to your package, as long as you have an
> :after (org oc)
> line in the package's use-package directive.
>
> On Thu, Jul 22, 2021 at 6:31 AM Bruce D'Arcus <bdarcus@gmail.com> wrote:
>>
>> The problem was load order I guess; putting this of the file fixes it.
>>
>> So when org-citemake-insert-processor is first loaded, it looks for
>> the two functions, which haven't been loaded yet.
>>
>> I still think a) the error message could say that (that the functions
>> aren't found or some such), and b) that it shouldn't break starting
>> Emacs.
>>
>> On Thu, Jul 22, 2021 at 4:27 AM Bruce D'Arcus <bdarcus@gmail.com> wrote:
>>
>> > If I comment out those lines and use the oc-basic style selector
>> > instead to start emacs, and from there reactivate this function and
>> > compile and reload the code from the buffer, THEN it works without
>> > error.
>>