Fix "fatal: no names found" errors on 'doom rebuild'

Some packages that depend on org (like elfeed) will load the built-in
org early in the rebuild/package install process, which causes org to
define org-release and org-git-version, sometimes overwriting our stubs
for it. Without our hack, org call 'git describe' in the org repo in an
attempt to determine the installed version, which won't work in a sparse
clone. To ensure future definitions never overwrite ours, we advise them
as well.

Also moves magit-version hack to its autoload file, for consistency with
org's hacks.
This commit is contained in:
Henrik Lissner 2019-08-07 16:31:45 -04:00
parent c8d6ab823b
commit 9ab49be564
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
4 changed files with 19 additions and 14 deletions

View file

@ -1,5 +1,19 @@
;;; lang/org/autoload/org.el -*- lexical-binding: t; -*-
;; HACK A necessary hack because org requires a compilation step after being
;; cloned, and during that compilation a org-version.el is generated with these
;; two functions, which return the output of a 'git describe ...' call in the
;; repo's root. Of course, this command won't work in a sparse clone, and more
;; than that, initiating these compilation step is a hassle, so...
;;;###autoload (defun +org--release-a () "9.3")
;;;###autoload (fset 'org-release #'+org--release-a)
;;;###autoload (fset 'org-git-version #'ignore)
;; Org itself may override the above if it's loaded too early by packages that
;; depend on it, so we have to advise it once again:
;;;###autoload (advice-add #'org-release :override #'+org--release-a)
;;;###autoload (advice-add #'org-git-version :override #'ignore)
;;
;;; Helpers

View file

@ -898,12 +898,3 @@ compelling reason, so..."
(org-clock-load))
:config
(add-hook 'kill-emacs-hook #'org-clock-save)))
;; HACK A necessary hack because org requires a compilation step after being
;; cloned, and during that compilation a org-version.el is generated with these
;; two functions, which return the output of a 'git describe ...' call in the
;; repo's root. Of course, this command won't work in a sparse clone, and more
;; than that, initiating these compilation step is a hassle, so...
(defun org-release () "9.3")
(fset 'org-git-version #'ignore)

View file

@ -1,5 +1,10 @@
;;; tools/magit/autoload.el -*- lexical-binding: t; -*-
;; HACK Magit complains loudly when it can't determine its own version, which is
;; the case when magit is built through straight. The warning is harmless,
;; however, so we just need it to shut up.
;;;###autoload (advice-add #'magit-version :around #'ignore)
;;;###autoload
(defun +magit-display-buffer-fn (buffer)
"Same as `magit-display-buffer-traditional', except...

View file

@ -17,11 +17,6 @@ It is passed a user and repository name.")
(setq transient-levels-file (concat doom-etc-dir "transient/levels")
transient-values-file (concat doom-etc-dir "transient/values")
transient-history-file (concat doom-etc-dir "transient/history"))
;; HACK Magit complains loudly when it can't determine its own version, which
;; is the case when magit is built through straight. The warning is
;; harmless, however, so we just need it to shut up.
(advice-add #'magit-version :around #'ignore)
:config
(setq transient-default-level 5
magit-revision-show-gravatars '("^Author: " . "^Commit: ")