[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [nongnu] elpa/org-contrib eaef050f28: lisp/ox-bibtex.el (org-bibtex-
From: |
Stefan Monnier |
Subject: |
Re: [nongnu] elpa/org-contrib eaef050f28: lisp/ox-bibtex.el (org-bibtex-goto-citation): Add missing require |
Date: |
Tue, 30 Jan 2024 12:31:25 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Ihor Radchenko [2024-01-30 15:19:47] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> The `declare-function` should be placed right next (after) the
>> `require`. In practice it (currently) makes no difference (because of
>> technical details of how `declare-function` is (currently) implemented),
>> but in theory it clarifies that you do not intend to claim that it's safe
>> to call `obe-citations` from anywhere within `ox-bibtex`, but only from
>> within `org-bibtex-goto-citation`.
>
> Interesting.
> I am wondering if byte-compiler can somehow detect such scenarios and
> throw a warning.
In theory, if you "fix" the code as I suggested and call `obe-citations`
from outside of `org-bibtex-goto-citation`., the byte-compiler could
emit a warning. Is that what you mean?
If you mean that the byte-compiler should warn about the current code,
it's kind of impossible: `declare-function` is specifically designed
to tell the compiler about the fact that a function is available when
the compiler doesn't know it.
IOW in order to figure out that the warning is ill-placed the compiler
would need to know how/when that function is defined, thus making
the declaration unnecessary anyway.
But yes, we could try and improve the tooling that checks those
`declare-function`s, tho currently we only provide checks to make sure
the function is indeed defined in the specified file. We don't try
to figure out if that function will indeed be loaded/available at the
point the `declare-function` is placed (which is a much more difficult
problem).
Stefan
- Re: [nongnu] elpa/org-contrib eaef050f28: lisp/ox-bibtex.el (org-bibtex-goto-citation): Add missing require, Stefan Monnier, 2024/01/30
- Re: [nongnu] elpa/org-contrib eaef050f28: lisp/ox-bibtex.el (org-bibtex-goto-citation): Add missing require, Ihor Radchenko, 2024/01/30
- Re: [nongnu] elpa/org-contrib eaef050f28: lisp/ox-bibtex.el (org-bibtex-goto-citation): Add missing require,
Stefan Monnier <=
- Re: [nongnu] elpa/org-contrib eaef050f28: lisp/ox-bibtex.el (org-bibtex-goto-citation): Add missing require, Ihor Radchenko, 2024/01/30
- Re: [nongnu] elpa/org-contrib eaef050f28: lisp/ox-bibtex.el (org-bibtex-goto-citation): Add missing require, Stefan Monnier, 2024/01/30
- Re: [nongnu] elpa/org-contrib eaef050f28: lisp/ox-bibtex.el (org-bibtex-goto-citation): Add missing require, Ihor Radchenko, 2024/01/30
- Re: [nongnu] elpa/org-contrib eaef050f28: lisp/ox-bibtex.el (org-bibtex-goto-citation): Add missing require, Stefan Monnier, 2024/01/30
- Re: [nongnu] elpa/org-contrib eaef050f28: lisp/ox-bibtex.el (org-bibtex-goto-citation): Add missing require, Emanuel Berg, 2024/01/31