branch: externals/org-modern commit 649f5d309a71d220826ac1437a58a8d4d7c4316b Author: JD Smith <93749+jdtsm...@users.noreply.github.com> Commit: JD Smith <93749+jdtsm...@users.noreply.github.com>
org-modern: incorporate and auto-enable org-modern-indent --- org-modern.el | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/org-modern.el b/org-modern.el index 22b3cba928..152e96f3ac 100644 --- a/org-modern.el +++ b/org-modern.el @@ -225,6 +225,11 @@ which specifies the offset of the block border from the edge of the window." :type '(choice boolean natnum)) +(defcustom org-modern-indent-block t + "Whether to style indented blocks when using `org-indent'. +See `org-modern-indent-mode'." + :type 'boolean) + (defcustom org-modern-keyword t "Prettify keywords like #+title. If set to t, the prefix #+ will be hidden. If set to a string, @@ -377,6 +382,9 @@ the font.") (defconst org-modern--table-overline '(:overline t)) (defconst org-modern--table-sp '((space :width (org-modern--table-sp-width)) (space :width (org-modern--table-sp-width)))) +(defvar org-indent-mode) +(defvar org-modern-indent-mode) +(declare-function org-modern-indent-mode "org-modern-indent") (defun org-modern--checkbox () "Prettify checkboxes according to `org-modern-checkbox'." @@ -796,7 +804,7 @@ whole buffer; otherwise, for the line at point." (2 '(face org-modern-label display #(" " 0 1 (face (:strike-through t)))) t)))) ;; Do not add source block fringe markers if org-indent-mode is ;; enabled. org-indent-mode uses line prefixes for indentation. - ;; Therefore we cannot have both. + ;; org-modern-indent handles this. (when (and org-modern-block-fringe (not (bound-and-true-p org-indent-mode))) '(("^[ \t]*#\\+\\(?:begin\\|BEGIN\\)_\\S-" (0 (org-modern--block-fringe))))) @@ -862,7 +870,9 @@ whole buffer; otherwise, for the line at point." (when (eq org-modern-star 'fold) (add-hook 'org-cycle-hook #'org-modern--cycle nil 'local)) (org-modern--update-faces) - (org-modern--update-bitmaps)) + (org-modern--update-bitmaps) + (when (and org-indent-mode org-modern-indent-block) + (org-modern-indent-mode 1))) (t (remove-from-invisibility-spec 'org-modern) (font-lock-remove-keywords nil org-modern--font-lock-keywords) @@ -872,7 +882,8 @@ whole buffer; otherwise, for the line at point." (remove-hook 'org-after-promote-entry-hook #'org-modern--unfontify-line 'local) (remove-hook 'org-after-demote-entry-hook #'org-modern--unfontify-line 'local) (when (eq org-modern-star 'fold) - (remove-hook 'org-cycle-hook #'org-modern--cycle 'local)))) + (remove-hook 'org-cycle-hook #'org-modern--cycle 'local)) + (when org-modern-indent-mode (org-modern-indent-mode 0)))) (without-restriction (with-silent-modifications (org-modern--unfontify (point-min) (point-max)))