Closed onlycparra closed 11 months ago
Thank you for the report.
It seems like org-inline-pdf.el
is byte-compiled before org
is loaded. Could you try re-byte-compiling org-inline-pdf.el
after M-: (require 'ob-core) RET
? Or you may execute doom build
(I don't use Doom Emacs and do not understand what it actually does though).
I run
doom build
and I get this in the output (among some previous and following similar lines):
> Building which-key...
> Building compat...
> Building tldr...
> Building org-inline-pdf...
> Building org-inline-pdf > Building org...
> Building org-inline-pdf...
> Building vertico...
> Building orderless...
> Building consult...
Apparently It gets that it needs org
before org-inline-pdf
, so it builds org
it first. Whet that is done, it goes back to org-inline-pdf
After building, I close all instances of emacs
and run doom sync
.
Finally, I open a .org
file that links to a .pdf
file. M-x org-inline-pdf-mode RET
and I get the same error:
byte-code: Invalid function: org-babel-temp-directory
Thank you testing. Could you try the following steps? Please translate appropriately for Doom Emacs if any.
M-: (require 'ob-core) RET
org-inline-pdf.el
is installed with dired
org-inline-pdf.elc
org-inline-pdf.el
manually by pressing b
And check if you get the same error here?
Alright. I followed your steps. Thanks for formatting them in "foolproof mode". I am new to doom emacs, actually :)
I found the installed libraries with this in my shell:
find ~ -name org-inline-pdf.elc 2>/dev/null
The files ended up being in:
/home/username/.config/emacs/.local/straight/build-28.2/org-inline-pdf/org-inline-pdf.elc
In emacs: run M-: (require 'ob-core) RET
Open the directory:
C-x C-f /home/username/.config/emacs/.local/straight/build-28.2/org-inline-pdf/ RET
Delete the elc
file: M-x delete-file RET org-inline-pdf.elc RET
Byte-compile el
file: M-x byte-compile-file RET org-inline-pdf.el RET
I obtained this warning:
Compiling file /home/username/.config/emacs/.local/straight/build-28.2/org-inline-pdf/org-inline-pdf.el at Sun Aug 6 22:03:13 2023
org-inline-pdf.el:122:5: Warning: Use keywords rather than deprecated positional arguments to `define-minor-mode'
Load the library: M-x load-library RET org-inline-pdf RET
Open a .org
file and add a link [[file:image.pdf]]
to it.
Run M-x org-inline-pdf-mode
I obtain an inline preview of the .pdf
file replacing the previously mentioned link.
I close all instances of emacs
, and reopen the .org
file. The results are the same. I still can see the image.
If there is a doom
versed person out there, please comment here to know how to make this work without manual intervention.
Finally, thanks, @shg for your help :grin:
No problem. And thank you for testing. I will also test it on Doom Emacs when I have time.
After upgrading to 29, this problem happens with vanilla emacs as well
@uliw Thank you for the report. I'm actually using 29 as well and I haven't confirmed the issue yet. However, I have thought of a possible cause and am testing it.
In the meantime, package-recompile-all
may fix the issue if you haven't done it yet, it's a command available from 29.
As far as I can tell, the problem arises with native compilation on startup. But calling package-recompile-all seems to fix the issue
I have also been using Emacs with native compilation on and am unsure if it is related, but thanks for the suggestion.
@onlycparra @uliw Although I haven't successfully reproduced the issue in my environment, maybe the commit I just made solves the problem. I appreciate if you can test it when you have time. It's already on MELPA.
Upgrade from working installation went without a hitch. Deleting the eln file, and restarting also worked. So at least for my case, this seems fixed. thx!
$ doom sync -u
(...)
✓ (28/136) org-inline-pdf.el: cd61240 -> 4a4a299 [3 commit(s)]
897ab7a Bump version to 0.4b
97e021e Define org-inline-pdf-cache-directory variable for user customization
504dab8 Define org-inline-pdf-cache-directory function
(...)
> (Re)building packages...
(...)
> Building org-inline-pdf...
(...)
The .elc
file was re-created.
$ date --rfc-3339=seconds && stat -c%w /home/username/.config/emacs/.local/straight/build-28.2/org-inline-pdf/org-inline-pdf.elc
2023-08-09 12:53:31-04:00
2023-08-09 12:48:53.495500236 -0400
Then, after killing all instances of emacs, I open my .org
file with the link. In emacs:
M-x org-inline-pdf-mode RET
And I get the same error.
org-inline-pdf-cache-directory: Invalid function: org-babel-temp-directory
Following https://github.com/shg/org-inline-pdf.el/issues/10#issuecomment-1667019552 again, fixes the issue.
@uliw @onlycparra Thank you for taking your time for testing.
@onlycparra I made an additional fix and put it in a branch.
https://github.com/shg/org-inline-pdf.el/tree/cachedir
I appreciate if you can test this. To replicate the same situation in which you encountered the reported error, I think it should be installed using Doom Emacs's package installation mechanism, which I do not know. I think there should be a way to install a local package from file.
@onlycparra The update is merged to main branch and will be available on MELPA soon.
Sorry for disappearing. I think it is working correctly now.
In Doom Emacs, I proceed to install the package with:
Then close all instances of
emacs
, rundoom sync
, open my org file with a link to pdf[[myfile.pdf]]
and try to load the modeM-x org-inline-pdf-mode
.I get the error
byte-code: Invalid function: org-babel-temp-directory
Doom and Org Versions