andras-simonyi / citeproc-el

A CSL 1.0.2 Citation Processor for Emacs.
GNU General Public License v3.0
84 stars 9 forks source link

Byte compile produces warnings for unknown functions #165

Closed Forge36 closed 2 weeks ago

Forge36 commented 1 month ago
 ■  Warning (comp): citeproc-s.el:240:21: Warning: the function ‘citeproc-s-replace’ is not known to be defined.
 ■  Warning (comp): citeproc-lib.el:159:33: Warning: the function ‘citeproc-rt-render-affixes’ is not known to be defined.
 ■  Warning (comp): citeproc-lib.el:154:55: Warning: the function ‘citeproc-context-vars’ is not known to be defined.
 ■  Warning (comp): citeproc-rt.el:538:25: Warning: the function ‘citeproc-itemdata-rawbibitem’ is not known to be defined.
 ■  Warning (comp): citeproc-prange.el:40:44: Warning: the function ‘citeproc-s-fill-copy’ is not known to be defined.
 ■  Warning (comp): citeproc-date.el:271:13: Warning: the function ‘citeproc-number--format-as-ordinal’ is not known to be defined.
 ■  Warning (comp): citeproc-formatters.el:384:48: Warning: the function ‘citeproc-rt-to-plain’ is not known to be defined.
 ■  Warning (comp): citeproc-formatters.el:164:21: Warning: the function ‘citeproc-s-replace-all-seq’ is not known to be defined.
 ■  Warning (comp): citeproc-sort.el:90:19: Warning: the function ‘citeproc-number-var-value’ is not known to be defined.
andras-simonyi commented 1 month ago

Hello, thanks for reporting! Could you describe in detail how you are trying to compile the program? (Operating System, Emacs version, with or without an init file?) If you are compiling with an init file then it would also be useful to try to reproduce the problem without one, e.g., using the "-q" switch when starting Emacs.

Forge36 commented 3 weeks ago

To my knowledge the native compilation is automatic (provide emacs is built with support). I'm not able to trigger this error directly with byte-recompile-file

System details:

I have an init file (emacs-version) GNU Emacs 29.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2024-05-10

OS Windows 10 in WSL (Ubuntu 22.04.4 LTS)

Some testing to reproduce: I modify citeproc-sort.el restart emacs, and insert a citation in org triggers the async-compile. I can then "fix" the citeproc-sort.el warning by adding (require 'citeproc-number).

I'm not having luck using emacs -q to produce a minimal test case unfortunately (I'm struggling to use emacs in that scenario). These warnings appear to only display on the native compile (which occurs after a restart of emacs in my instance).

I'm going to poke at an MR to address these if I can determine how (I'm new to upstreaming fixes apologies if I'm not following proper etiquette).

Edit: Found the docs on fixing these

https://www.gnu.org/software/emacs/manual/html_node/elisp/Declaring-Functions.html

I've usually seen these resolved with (require 'package') (which is how I based my draft MR). Given there aren't any known errors/issues that suggests the use of (declare-function <function> "<package>" ()). I can use this method to resolve the warnings without risking behavior changes.

Edit 2: Draft MR is up-to-date. Let me know what changes you'd like.

Forge36 commented 2 weeks ago

This appears fixed with the latest #169!

Closing