Only realign tables in +org-realign-table-maybe-h

Don't recalculate formulas.
This commit is contained in:
Henrik Lissner 2020-04-13 15:23:16 -04:00
parent 006eee75d0
commit 41606f5369
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 20 additions and 16 deletions

View file

@ -46,11 +46,10 @@ re-align the table if necessary. (Necessary because org-mode has a
;;;###autoload ;;;###autoload
(defun +org-realign-table-maybe-h () (defun +org-realign-table-maybe-h ()
"Auto-align table under cursor and re-calculate formulas." "Auto-align table under cursor."
(when (and (org-at-table-p) org-table-may-need-update) (when (and (org-at-table-p) org-table-may-need-update)
(let ((pt (point)) (let ((pt (point))
(inhibit-message t)) (inhibit-message t))
(org-table-recalculate)
(if org-table-may-need-update (org-table-align)) (if org-table-may-need-update (org-table-align))
(goto-char pt)))) (goto-char pt))))

View file

@ -208,11 +208,23 @@ Is relative to `org-directory', unless it is absolute. Is used in Doom's default
(defun +org-init-babel-lazy-loader-h () (defun +org-init-babel-lazy-loader-h ()
"Load babel libraries lazily when babel blocks are executed." "Load babel libraries lazily when babel blocks are executed."
(defun +org--babel-lazy-load (lang) (defun +org--babel-lazy-load (lang &optional async)
(cl-check-type lang symbol) (cl-check-type lang (or symbol null))
(or (run-hook-with-args-until-success '+org-babel-load-functions lang) (unless (cdr (assq lang org-babel-load-languages))
(require (intern (format "ob-%s" lang)) nil t) (when async
(require lang nil t))) ;; ob-async has its own agenda for lazy loading packages (in the child
;; process), so we only need to make sure it's loaded.
(require 'ob-async nil t))
(prog1 (or (run-hook-with-args-until-success '+org-babel-load-functions lang)
(require (intern (format "ob-%s" lang)) nil t)
(require lang nil t))
(add-to-list 'org-babel-load-languages (cons lang t)))))
;; Lazy load babel packages for exporting
(add-hook! 'org-export-filter-src-block-functions
(defun lazy-load-library-h (data lang plist)
(+org--babel-lazy-load lang)
data))
(defadvice! +org--src-lazy-load-library-a (lang) (defadvice! +org--src-lazy-load-library-a (lang)
"Lazy load a babel package to ensure syntax highlighting." "Lazy load a babel package to ensure syntax highlighting."
@ -220,7 +232,7 @@ Is relative to `org-directory', unless it is absolute. Is used in Doom's default
(or (cdr (assoc lang org-src-lang-modes)) (or (cdr (assoc lang org-src-lang-modes))
(+org--babel-lazy-load lang))) (+org--babel-lazy-load lang)))
;; This also works for tangling and exporting ;; This also works for tangling
(defadvice! +org--babel-lazy-load-library-a (info) (defadvice! +org--babel-lazy-load-library-a (info)
"Load babel libraries lazily when babel blocks are executed." "Load babel libraries lazily when babel blocks are executed."
:after-while #'org-babel-confirm-evaluate :after-while #'org-babel-confirm-evaluate
@ -229,14 +241,7 @@ Is relative to `org-directory', unless it is absolute. Is used in Doom's default
((stringp lang) (intern lang)))) ((stringp lang) (intern lang))))
(lang (or (cdr (assq lang +org-babel-mode-alist)) (lang (or (cdr (assq lang +org-babel-mode-alist))
lang))) lang)))
(when (and lang (+org--babel-lazy-load lang (assq :async (nth 2 info)))
(not (cdr (assq lang org-babel-load-languages)))
(+org--babel-lazy-load lang))
(when (assq :async (nth 2 info))
;; ob-async has its own agenda for lazy loading packages (in the
;; child process), so we only need to make sure it's loaded.
(require 'ob-async nil t))
(add-to-list 'org-babel-load-languages (cons lang t)))
t)) t))
(advice-add #'org-babel-do-load-languages :override #'ignore)) (advice-add #'org-babel-do-load-languages :override #'ignore))