lang/org: refactor org config load order
- No longer use org-load-hook; it was unnecessary and there were corner cases where org would get loaded before hooks were added to it. - Update comments - Remove config that was redundant with org's defaults (wrt org-file-apps) - Perform persp-mode check before using persp-mode API in +org|exclude-agenda-buffers-from-workspace advice. - Update outdated smartparens config and move it out of org-mode-hook (only needs to be run once, not everytime org-mode is enabled) - Autoload mode hooks
This commit is contained in:
parent
3da6c23d75
commit
653161fe2e
3 changed files with 117 additions and 135 deletions
|
@ -34,7 +34,7 @@ current file). Only scans first 2048 bytes of the document."
|
|||
|
||||
|
||||
;;
|
||||
;; Modes
|
||||
;;; Modes
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode +org-pretty-mode
|
||||
|
@ -50,7 +50,7 @@ current file). Only scans first 2048 bytes of the document."
|
|||
|
||||
|
||||
;;
|
||||
;; Commands
|
||||
;;; Commands
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/dwim-at-point ()
|
||||
|
@ -334,7 +334,7 @@ another level of headings on each invocation."
|
|||
|
||||
|
||||
;;
|
||||
;; Hooks
|
||||
;;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun +org|delete-backward-char-and-realign-table-maybe ()
|
||||
|
@ -440,9 +440,38 @@ with `org-cycle')."
|
|||
(org-remove-occur-highlights)
|
||||
t))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org|unfold-to-2nd-level-or-point ()
|
||||
"My version of the 'overview' #+STARTUP option: expand first-level headings.
|
||||
Expands the first level, but no further. If point was left somewhere deeper,
|
||||
unfold to point on startup."
|
||||
(unless org-agenda-inhibit-startup
|
||||
(when (eq org-startup-folded t)
|
||||
(outline-hide-sublevels 2))
|
||||
(when (outline-invisible-p)
|
||||
(ignore-errors
|
||||
(save-excursion
|
||||
(outline-previous-visible-heading 1)
|
||||
(org-show-subtree))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org|enable-auto-reformat-tables ()
|
||||
"Realign tables & update formulas when exiting insert mode (`evil-mode')."
|
||||
(when (featurep 'evil)
|
||||
(add-hook 'evil-insert-state-exit-hook #'+org|realign-table-maybe nil t)
|
||||
(add-hook 'evil-replace-state-exit-hook #'+org|realign-table-maybe nil t)
|
||||
(advice-add #'evil-replace :after #'+org*realign-table-maybe)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org|enable-auto-update-cookies ()
|
||||
"Update statistics cookies when saving or exiting insert mode (`evil-mode')."
|
||||
(when (featurep 'evil)
|
||||
(add-hook 'evil-insert-state-exit-hook #'+org|update-cookies nil t))
|
||||
(add-hook 'before-save-hook #'+org|update-cookies nil t))
|
||||
|
||||
|
||||
;;
|
||||
;; Advice
|
||||
;;; Advice
|
||||
|
||||
;;;###autoload
|
||||
(defun +org*fix-newline-and-indent-in-src-blocks ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue