branch: externals/org-modern commit 1e34e97efe64588f135c1743b08739f0f3945e4a Author: JD Smith <93749+jdtsm...@users.noreply.github.com> Commit: JD Smith <93749+jdtsm...@users.noreply.github.com>
Does not require org-modern (use with or without) --- README.md | 4 ++-- org-modern-indent.el | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 6032604337..92b5fba2e7 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [`org-modern`](https://github.com/minad/org-modern) provides a clean and efficient org style. The blocks (e.g. source, example) are particularly nice. But when `org-indent` is enabled, the block "bracket", which uses the fringe, is disabled. -This small package reproduces the block styling of `org-modern` when `org-indent` is enabled. +This small package reproduces the block styling of `org-modern`, even when `org-indent` is enabled. <p align="center"> <img src=https://user-images.githubusercontent.com/93749/172438142-d4090856-dea8-43d0-a68a-bba29198575f.png> @@ -11,7 +11,7 @@ This small package reproduces the block styling of `org-modern` when `org-indent ## Notes -This package is only for users of `org-indent-mode`, and will enable indent if not set. Non-zero `line-spacing` will introduce gaps between the block bracket characters. +This package is only for users of `org-indent-mode`, and will enable indent if not set. Non-zero `line-spacing` will introduce gaps between the block bracket characters. Can be used _with or without_ `org-modern`. ## Configure diff --git a/org-modern-indent.el b/org-modern-indent.el index f8e515fbaa..e3ab9e150b 100644 --- a/org-modern-indent.el +++ b/org-modern-indent.el @@ -24,17 +24,15 @@ ;;; Commentary: -;; org-modern-indent enables the block highlighting of org-modern, +;; org-modern-indent provides the block highlighting of org-modern, ;; even when org-indent is enabled. ;; Requires: -;; - org-modern ;; - org-indent-mode enabled +;; +;; Can be used with or without org-modern. ;;; Code: -(eval-when-compile - (require 'cl-lib)) (require 'org-indent) -(require 'org-modern) (require 'seq) (defun org-modern-indent--face-in (faces element) @@ -62,9 +60,10 @@ explicitly, or inherited." (defvar org-modern-indent-guide nil) (defvar org-modern-indent-end nil) (defun org-modern-indent-set-line-properties (level indentation &optional heading) - "A redefinition of `org-indent-set-line-properties' for org-modern block style. -Treats blocks specially, by extending the line and wrap prefixes -with a box guide unicode character." + "An org-modern inspired redefinition of `org-indent-set-line-properties'. +Used to approximate org-modern block style. Treats blocks +specially, by extending the line and wrap prefixes with a box +guide unicode character." (let ((line (aref (pcase heading (`nil org-indent--text-line-prefixes) (`inlinetask org-indent--inlinetask-line-prefixes) @@ -108,10 +107,15 @@ with a box guide unicode character." (symbol-function 'org-indent-set-line-properties) "Original `org-indent-set-line-properties' function.") +(defgroup org-modern-indent nil + "org-modern style blocks with org-indent." + :group 'org + :prefix "org-modern-indent") + (define-minor-mode org-modern-indent-mode "Org-modern with org-indent" :global nil - :group 'org-modern + :group 'org-modern-indent (if org-modern-indent-mode (progn (setq org-modern-indent-begin