Skip to content

Commit 81f5a8f

Browse files
committed
fix(org): "No org-loaddefs.el file" errors
Org complains if org-loaddefs.el is missing, but Straight generates a org-autoloads.el instead (and loads it separately), so we need only fool Org it exists.
1 parent 719716c commit 81f5a8f

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

modules/lang/org/packages.el

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,34 @@
33

44
(package! org
55
:recipe (:host github
6-
;; REVIEW I intentionally avoid git.savannah.gnu.org because of SSL
6+
;; REVIEW: I intentionally avoid git.savannah.gnu.org because of SSL
77
;; issues (see #5655), uptime issues, download time, and lack of
88
;; shallow clone support.
99
:repo "emacs-straight/org-mode"
1010
:files (:defaults "etc")
1111
:depth 1
12-
;; HACK Org requires a post-install compilation step to generate a
13-
;; org-version.el with org-release and org-git-version functions,
14-
;; using a 'git describe ...' call. This won't work in a sparse
15-
;; clone and I value smaller network burdens on users over
16-
;; non-essential variables so we fake it:
12+
;; HACK: Org has a post-install step that generates org-version.el
13+
;; and org-loaddefs.el, but Straight doesn't invoke this step, and
14+
;; the former doesn't work if the Org repo is a shallow clone.
15+
;; Rather than impose the network burden of a full clone (and other
16+
;; redundant work in Org's makefile), I'd rather fake these files
17+
;; instead. Besides, Straight already produces a org-autoloads.el,
18+
;; so org-loaddefs.el isn't needed.
1719
:build t
1820
:pre-build
19-
(with-temp-file "org-version.el"
20-
(let ((version
21-
(with-temp-buffer
22-
(insert-file-contents (doom-path "lisp/org.el") nil 0 1024)
23-
(if (re-search-forward "^;; Version: \\([^\n-]+\\)" nil t)
24-
(match-string-no-properties 1)
25-
"Unknown"))))
26-
(insert (format "(defun org-release () %S)\n" version)
27-
(format "(defun org-git-version (&rest _) \"%s-??-%s\")\n"
28-
version (cdr (doom-call-process "git" "rev-parse" "--short" "HEAD")))
29-
"(provide 'org-version)\n"))))
21+
(progn
22+
(with-temp-file "org-loaddefs.el")
23+
(with-temp-file "org-version.el"
24+
(let ((version
25+
(with-temp-buffer
26+
(insert-file-contents (doom-path "lisp/org.el") nil 0 1024)
27+
(if (re-search-forward "^;; Version: \\([^\n-]+\\)" nil t)
28+
(match-string-no-properties 1)
29+
"Unknown"))))
30+
(insert (format "(defun org-release () %S)\n" version)
31+
(format "(defun org-git-version (&rest _) \"%s-??-%s\")\n"
32+
version (cdr (doom-call-process "git" "rev-parse" "--short" "HEAD")))
33+
"(provide 'org-version)\n")))))
3034
:pin "fe92a3cedba541482d5954eacb2b13e6f57a39c4")
3135
(package! org-contrib
3236
:recipe (:host github

0 commit comments

Comments
 (0)