From: Amin Bandali Date: Mon, 24 Dec 2018 23:17:32 +0000 (-0500) Subject: [emacs][wip] a/async-babel-tangle: add option to byte-recompile-file X-Git-Url: https://git.shemshak.org/gitweb.cgi/~bandali/configs/commitdiff_plain/c31b1ac02d0c0b4c375384dc72cc26073ecb526c [emacs][wip] a/async-babel-tangle: add option to byte-recompile-file --- diff --git a/init.org b/init.org index 3d29991..3cf7343 100644 --- a/init.org +++ b/init.org @@ -897,9 +897,12 @@ file. (defvar a/show-async-tangle-time nil "Show the time spent tangling the file.") - (defvar a/async-tangle-post-compile "make ti" + (defvar a/async-tangle-post-compile nil "If non-nil, pass to `compile' after successful tangle.") + (defvar a/async-tangle-byte-recompile t + "If non-nil, byte-recompile the file on successful tangle.") + (defun a/async-babel-tangle () "Tangle org file asynchronously." (interactive) @@ -907,7 +910,7 @@ file. (file (buffer-file-name)) (file-nodir (file-name-nondirectory file)) ;; (async-quiet-switch "-q") - ) + (file-noext (file-name-sans-extension file))) (async-start `(lambda () (require 'org) @@ -916,6 +919,7 @@ file. `(lambda (result) (if result (progn + (setq byte-compile-warnings '(not noruntime unresolved)) (message "Tangled %s%s" ,file-nodir (if a/show-async-tangle-time @@ -924,7 +928,9 @@ file. ',file-tangle-start-time))) "")) (when a/async-tangle-post-compile - (compile a/async-tangle-post-compile))) + (compile a/async-tangle-post-compile)) + (when a/async-tangle-byte-recompile + (byte-recompile-file (concat ,file-noext ".el")))) (message "Tangling %s failed" ,file-nodir)))))))) (add-to-list @@ -2432,6 +2438,6 @@ Display how long it took to load the init file. * COMMENT Local Variables :ARCHIVE: # Local Variables: -# eval: ;; (add-hook 'after-save-hook #'a/async-babel-tangle 'append 'local) +# eval: (add-hook 'after-save-hook #'a/async-babel-tangle 'append 'local) # eval: (typo-mode -1) # End: