Org-store-link in Gnus summary fails

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Org-store-link in Gnus summary fails

Narendra Joshi
Hi,

I get the following error when I try to store link to a line in Gnus
summary. This happens because `org-store-link' tries to do a `mapcar' on
a list of functions calling them with `funcall'. One of those items in
the list-- `gnus-summary-article-header'-- is a macro. Hence, it
fails. How can this be fixed?

Debugger entered--Lisp error: (invalid-function gnus-summary-article-header)
  gnus-summary-article-header()
  org-gnus-store-link()
  #f(compiled-function (f) #<bytecode 0x174a15d>)(org-gnus-store-link)
  mapcar(#f(compiled-function (f) #<bytecode 0x174a15d>) (org-rmail-store-link org-mhe-store-link org-irc-store-link org-info-store-link org-gnus-store-link org-docview-store-link org-bibtex-store-link org-bbdb-store-link org-w3m-store-link elfeed-link-store-link))
  org-store-link(nil)
  funcall-interactively(org-store-link nil)
  #<subr call-interactively>(org-store-link nil nil)
  apply(#<subr call-interactively> org-store-link (nil nil))
  call-interactively@ido-cr+-record-current-command(#<subr call-interactively> org-store-link nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (org-store-link nil nil))
  call-interactively(org-store-link nil nil)
  command-execute(org-store-link)


Thanks,
--
Narendra Joshi

Reply | Threaded
Open this post in threaded view
|

Re: Org-store-link in Gnus summary fails

Narendra Joshi
Narendra Joshi <[hidden email]> writes:

> Hi,
>
> I get the following error when I try to store link to a line in Gnus
> summary. This happens because `org-store-link' tries to do a `mapcar' on
> a list of functions calling them with `funcall'. One of those items in
> the list-- `gnus-summary-article-header'-- is a macro. Hence, it
> fails. How can this be fixed?
The strange thing is that if I go and re-evaluate the function
`org-gnus-store-link', it starts working.

Please help me understand what is happening here.

> Debugger entered--Lisp error: (invalid-function gnus-summary-article-header)
>   gnus-summary-article-header()
>   org-gnus-store-link()
>   #f(compiled-function (f) #<bytecode 0x174a15d>)(org-gnus-store-link)
>   mapcar(#f(compiled-function (f) #<bytecode 0x174a15d>) (org-rmail-store-link
> org-mhe-store-link org-irc-store-link org-info-store-link org-gnus-store-link
> org-docview-store-link org-bibtex-store-link org-bbdb-store-link
> org-w3m-store-link elfeed-link-store-link))
>   org-store-link(nil)
>   funcall-interactively(org-store-link nil)
>   #<subr call-interactively>(org-store-link nil nil)
>   apply(#<subr call-interactively> org-store-link (nil nil))
>   call-interactively@ido-cr+-record-current-command(#<subr call-interactively> org-store-link nil nil)
>   apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (org-store-link nil nil))
>   call-interactively(org-store-link nil nil)
>   command-execute(org-store-link)
>
>
> Thanks,

--
Narendra Joshi

Reply | Threaded
Open this post in threaded view
|

Re: Org-store-link in Gnus summary fails

Michael Heerdegen
Narendra Joshi <[hidden email]> writes:

> The strange thing is that if I go and re-evaluate the function
> `org-gnus-store-link', it starts working.
>
> Please help me understand what is happening here.
> > Debugger entered--Lisp error: (invalid-function
> > gnus-summary-article-header)
> >   gnus-summary-article-header()
> >   org-gnus-store-link()
> >   #f(compiled-function (f) #<bytecode 0x174a15d>)(org-gnus-store-link)
> >   mapcar(#f(compiled-function (f) #<bytecode 0x174a15d>)
> > (org-rmail-store-link
> > org-mhe-store-link org-irc-store-link org-info-store-link
> > org-gnus-store-link
> > org-docview-store-link org-bibtex-store-link org-bbdb-store-link
> > org-w3m-store-link elfeed-link-store-link))
> >   org-store-link(nil)
> >   funcall-interactively(org-store-link nil)
> >   #<subr call-interactively>(org-store-link nil nil)
> >   apply(#<subr call-interactively> org-store-link (nil nil))
> >   call-interactively@ido-cr+-record-current-command(#<subr
> > call-interactively> org-store-link nil nil)
> >   apply(call-interactively@ido-cr+-record-current-command #<subr
> > call-interactively> (org-store-link nil nil))
> >   call-interactively(org-store-link nil nil)
> >   command-execute(org-store-link)

This kind of error happens when a file had been compiled without the
according macro definition been loaded.

If just recompiling doesn't help, there is probably a missing dependency
(at compile time).


Michael.

Reply | Threaded
Open this post in threaded view
|

Re: Org-store-link in Gnus summary fails

Narendra Joshi
Re-evaluating the org function that refers the macro fixes it. If the macro
definition had been loaded when the file was compiled, how does it make
funcall work on the macro anyways?

Thanks for the help,
Narendra Joshi
On 11 Nov 2017 18:06, "Michael Heerdegen" <[hidden email]> wrote:

> Narendra Joshi <[hidden email]> writes:
>
> > The strange thing is that if I go and re-evaluate the function
> > `org-gnus-store-link', it starts working.
> >
> > Please help me understand what is happening here.
> > > Debugger entered--Lisp error: (invalid-function
> > > gnus-summary-article-header)
> > >   gnus-summary-article-header()
> > >   org-gnus-store-link()
> > >   #f(compiled-function (f) #<bytecode 0x174a15d>)(org-gnus-store-link)
> > >   mapcar(#f(compiled-function (f) #<bytecode 0x174a15d>)
> > > (org-rmail-store-link
> > > org-mhe-store-link org-irc-store-link org-info-store-link
> > > org-gnus-store-link
> > > org-docview-store-link org-bibtex-store-link org-bbdb-store-link
> > > org-w3m-store-link elfeed-link-store-link))
> > >   org-store-link(nil)
> > >   funcall-interactively(org-store-link nil)
> > >   #<subr call-interactively>(org-store-link nil nil)
> > >   apply(#<subr call-interactively> org-store-link (nil nil))
> > >   call-interactively@ido-cr+-record-current-command(#<subr
> > > call-interactively> org-store-link nil nil)
> > >   apply(call-interactively@ido-cr+-record-current-command #<subr
> > > call-interactively> (org-store-link nil nil))
> > >   call-interactively(org-store-link nil nil)
> > >   command-execute(org-store-link)
>
> This kind of error happens when a file had been compiled without the
> according macro definition been loaded.
>
> If just recompiling doesn't help, there is probably a missing dependency
> (at compile time).
>
>
> Michael.
>
Reply | Threaded
Open this post in threaded view
|

Re: Org-store-link in Gnus summary fails

Eric Abrahamsen-2
In reply to this post by Michael Heerdegen
Michael Heerdegen <[hidden email]> writes:

> Narendra Joshi <[hidden email]> writes:
>
>> The strange thing is that if I go and re-evaluate the function
>> `org-gnus-store-link', it starts working.
>>
>> Please help me understand what is happening here.
>> > Debugger entered--Lisp error: (invalid-function
>> > gnus-summary-article-header)
>> >   gnus-summary-article-header()
>> >   org-gnus-store-link()
>> >   #f(compiled-function (f) #<bytecode 0x174a15d>)(org-gnus-store-link)
>> >   mapcar(#f(compiled-function (f) #<bytecode 0x174a15d>)
>> > (org-rmail-store-link
>> > org-mhe-store-link org-irc-store-link org-info-store-link
>> > org-gnus-store-link
>> > org-docview-store-link org-bibtex-store-link org-bbdb-store-link
>> > org-w3m-store-link elfeed-link-store-link))
>> >   org-store-link(nil)
>> >   funcall-interactively(org-store-link nil)
>> >   #<subr call-interactively>(org-store-link nil nil)
>> >   apply(#<subr call-interactively> org-store-link (nil nil))
>> >   call-interactively@ido-cr+-record-current-command(#<subr
>> > call-interactively> org-store-link nil nil)
>> >   apply(call-interactively@ido-cr+-record-current-command #<subr
>> > call-interactively> (org-store-link nil nil))
>> >   call-interactively(org-store-link nil nil)
>> >   command-execute(org-store-link)
>
> This kind of error happens when a file had been compiled without the
> according macro definition been loaded.
>
> If just recompiling doesn't help, there is probably a missing dependency
> (at compile time).

It looks like org-gnus is missing several dependencies:

(eval-when-compile
  (require 'gnus-sum)
  (require 'nnheader)
  (require 'nnir))

Reply | Threaded
Open this post in threaded view
|

Re: Org-store-link in Gnus summary fails

Michael Heerdegen
In reply to this post by Narendra Joshi
Narendra Joshi <[hidden email]> writes:

> Re-evaluating the org function that refers the macro fixes it. If the
> macro definition had been loaded when the file was compiled, how does
> it make funcall work on the macro anyways?

AFAICT, that's a difference between interpreted and compiled Elisp code:
symbols in compiled code can't refer to macros - these must be expanded
when code is compiled.  You get a compiler error ("unknown function")
when macro definitions are not loaded, so this is not that hard to
catch.


Michael.

Reply | Threaded
Open this post in threaded view
|

Re: Org-store-link in Gnus summary fails

Michael Heerdegen
In reply to this post by Eric Abrahamsen-2
Eric Abrahamsen <[hidden email]> writes:

> It looks like org-gnus is missing several dependencies:
>
> (eval-when-compile
>   (require 'gnus-sum)
>   (require 'nnheader)
>   (require 'nnir))

Hmm, can then somebody who can reproduce the error please make a bug
report?


Thanks,

Michael.

Reply | Threaded
Open this post in threaded view
|

Re: Org-store-link in Gnus summary fails

Eric Abrahamsen-2
Michael Heerdegen <[hidden email]> writes:

> Eric Abrahamsen <[hidden email]> writes:
>
>> It looks like org-gnus is missing several dependencies:
>>
>> (eval-when-compile
>>   (require 'gnus-sum)
>>   (require 'nnheader)
>>   (require 'nnir))
>
> Hmm, can then somebody who can reproduce the error please make a bug
> report?

It's not really a mapcar/funcall problem: the mapcar is over
(org-store-link-functions), not over any Gnus macro. The function
`org-gnus-store-link' does use a bunch of Gnus macros, but not in a
funcall situation.

OP appears to be using Emacs master, otherwise I would guess that it had
to do with Gnus not being preloaded. If I run "make" in the org-mode git
repo, there are no complaints about Gnus macros being undefined, so I
don't know what's going on.

What's the Org version in question?

Eric

Reply | Threaded
Open this post in threaded view
|

Re: Org-store-link in Gnus summary fails

Michael Heerdegen
Eric Abrahamsen <[hidden email]> writes:

> >> (eval-when-compile
> >>   (require 'gnus-sum)
> >>   (require 'nnheader)
> >>   (require 'nnir))
> >
> > Hmm, can then somebody who can reproduce the error please make a bug
> > report?
>
> It's not really a mapcar/funcall problem: the mapcar is over
> (org-store-link-functions), not over any Gnus macro. The function
> `org-gnus-store-link' does use a bunch of Gnus macros, but not in a
> funcall situation.

For that kind of error to happen, it's enough to call the macro in the
code somewhere.  This has nothing to do with `funcall'ing or
`mapcar'ing.  If a macro is not known at compile time, the compiler
turns the macro call into a function call.


Michael.

Reply | Threaded
Open this post in threaded view
|

Re: Org-store-link in Gnus summary fails

Eric Abrahamsen-2
Michael Heerdegen <[hidden email]> writes:

> Eric Abrahamsen <[hidden email]> writes:
>
>> >> (eval-when-compile
>> >>   (require 'gnus-sum)
>> >>   (require 'nnheader)
>> >>   (require 'nnir))
>> >
>> > Hmm, can then somebody who can reproduce the error please make a bug
>> > report?
>>
>> It's not really a mapcar/funcall problem: the mapcar is over
>> (org-store-link-functions), not over any Gnus macro. The function
>> `org-gnus-store-link' does use a bunch of Gnus macros, but not in a
>> funcall situation.
>
> For that kind of error to happen, it's enough to call the macro in the
> code somewhere.  This has nothing to do with `funcall'ing or
> `mapcar'ing.

Right, I just meant I think the OP was a bit off with the original error
report.

> If a macro is not known at compile time, the compiler turns the macro
> call into a function call.

I was wondering if that was the case. Thanks for the information, that's
useful to know!

Reply | Threaded
Open this post in threaded view
|

Re: Org-store-link in Gnus summary fails

Michael Heerdegen
In reply to this post by Michael Heerdegen
Michael Heerdegen <[hidden email]> writes:

> Hmm, can then somebody who can reproduce the error please make a bug
> report?

I reported this as bug#29329 and CC'd both of you.


Thanks,

Michael.