~moved all ob-tangle code to a with-eval-after-load
Instead of using an autoload which may or may not work, rely on with-eval-after-load to handle the loading period.
This commit is contained in:
@@ -26,11 +26,8 @@
|
|||||||
(straight-use-package 'use-package)
|
(straight-use-package 'use-package)
|
||||||
|
|
||||||
;;; Load literate
|
;;; Load literate
|
||||||
;; setup autoload for org-tangle
|
|
||||||
(autoload 'org-babel-tangle-file "ob-tangle")
|
|
||||||
|
|
||||||
;; Setup directories and constants
|
;; Setup directories and constants
|
||||||
(setq user-emacs-directory "~/.config/emacs/")
|
|
||||||
(defconst +literate/org-files (list (concat user-emacs-directory "config.org")))
|
(defconst +literate/org-files (list (concat user-emacs-directory "config.org")))
|
||||||
(defconst +literate/output-files
|
(defconst +literate/output-files
|
||||||
(mapcar #'(lambda (x) (replace-regexp-in-string ".org" ".el" x)) +literate/org-files))
|
(mapcar #'(lambda (x) (replace-regexp-in-string ".org" ".el" x)) +literate/org-files))
|
||||||
@@ -47,21 +44,25 @@
|
|||||||
:initial-value t)
|
:initial-value t)
|
||||||
(file-exists-p (car +literate/output-files))))
|
(file-exists-p (car +literate/output-files))))
|
||||||
|
|
||||||
(defun +literate/compile-config ()
|
|
||||||
"Compile all files in +literate/org-files via org-babel-tangle."
|
|
||||||
(mapc #'org-babel-tangle-file +literate/org-files))
|
|
||||||
|
|
||||||
;; Killing Emacs hook
|
;; Killing Emacs hook
|
||||||
(add-hook
|
(unless (daemonp)
|
||||||
'kill-emacs-hook
|
(add-hook
|
||||||
#'(lambda ()
|
'kill-emacs-hook
|
||||||
(unless (y-or-n-p "Really exit emacs?: ")
|
#'(lambda ()
|
||||||
(keyboard-quit))
|
(unless (y-or-n-p "Really exit emacs? ")
|
||||||
(+literate/compile-config)))
|
(keyboard-quit)))))
|
||||||
|
|
||||||
;; When no output files exist, compile
|
(with-eval-after-load "ob-tangle"
|
||||||
(unless (+literate/org-files-exist)
|
(defun +literate/compile-config ()
|
||||||
(+literate/compile-config))
|
"Compile all files in +literate/org-files via org-babel-tangle."
|
||||||
|
(mapc #'org-babel-tangle-file +literate/org-files))
|
||||||
|
|
||||||
|
(add-hook
|
||||||
|
'kill-emacs-hook
|
||||||
|
#'+literate/compile-config)
|
||||||
|
|
||||||
|
(unless (+literate/org-files-exist)
|
||||||
|
(+literate/compile-config)))
|
||||||
|
|
||||||
(+literate/load-config)
|
(+literate/load-config)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user