Skip to content
This repository has been archived by the owner on Aug 7, 2022. It is now read-only.

Fix "undefined function" errors with native-comp #588

Closed
wants to merge 1 commit into from

Conversation

flatwhatson
Copy link

This solves an error that arises from compiling pdf-tools. The pdf-view-current-page macro isn't visible in pdf-cache.el, so the compiler assumes it's a function to be defined later. We then get an error about undefined function every time pdf-cache--prefetch-start is called.

I took the "nuclear" approach of solving this by moving the macros from pdf-view.el out into their own file, though it may be solvable with some more careful re-shuffling if you prefer.

@flatwhatson flatwhatson changed the title Factor out macros to ensure they're visible in pdf-cache.el Fix "undefined function" errors with native-comp Aug 15, 2020
hlissner added a commit to doomemacs/doomemacs that referenced this pull request Aug 22, 2020
politza/pdf-tools@c510442 -> flatwhatson/pdf-tools@86db180

Moved to flatwhatson's fork, which fixes
politza/pdf-tools#588 (void-function errors on gccemacs).
@spacekitteh
Copy link

@politza ?

@tmalsburg
Copy link

My understanding is that native compilation should be completely transparent. Doesn't this issue suggest a problem with native-comp that should be fixed there?

@flatwhatson
Copy link
Author

It's not specific to native-comp, it's actually a byte-compilation error (reported as a warning) which is exposed by native-comp. It's easy to reproduce by byte-compiling that file on its own:

$ emacs --batch -L lisp -f batch-byte-compile lisp/pdf-cache.el

In end of data:
lisp/pdf-cache.el:457:1: Warning: the following functions are not known to be
    defined: pdf-view-current-page, pdf-view-use-scaling-p,
    pdf-view-create-page, pdf-view-desired-image-size

@vedang
Copy link

vedang commented Feb 21, 2021

Hey @flatwhatson,

I'm working on merging these changes in. Moving the macros to their own file makes sense to me. One thing you missed was removing / updating the declare-function calls that have been used to inform code where these macros are defined. I'm pushing that change in a different commit.

As for the rest of the byte-compilation warnings, I have added this as a task on my todo list (to check byte-compilation warnings and fix them where possible)

Thanks!

@vedang
Copy link

vedang commented Feb 21, 2021

Hey @flatwhatson,

I've merged this PR into vedang/pdf-tools@master . Thank you for submitting this change!

@seagle0128
Copy link

Hi, May I know the status of this PR? I am experiencing the same issue.

@vedang
Copy link

vedang commented Apr 25, 2021 via email

@seagle0128
Copy link

@vedang thank you for letting me know. And I'm happy there is someone to maintain pdf-tools. But it seems MELPA still uses this repo. Can you please confirm and update melpa accordingly? Thanks a lot!

@vedang
Copy link

vedang commented Apr 25, 2021 via email

@vedang
Copy link

vedang commented May 30, 2021

Update - MELPA now points to vedang/pdf-tools . @flatwhatson, if you can close this PR, that will be great.

@flatwhatson
Copy link
Author

Great, thanks :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants