[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-modern 6b925b71ee 19/65: Add org-modern-label-borde
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-modern 6b925b71ee 19/65: Add org-modern-label-border, do not overwrite line-spacing |
Date: |
Mon, 7 Mar 2022 12:57:45 -0500 (EST) |
branch: externals/org-modern
commit 6b925b71eed8a10e1bb33f1bb066a4ff291f3c80
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Add org-modern-label-border, do not overwrite line-spacing
---
README.org | 4 ++++
org-modern.el | 43 ++++++++++++++++++++++++++-----------------
2 files changed, 30 insertions(+), 17 deletions(-)
diff --git a/README.org b/README.org
index c007182fbb..a22ec61449 100644
--- a/README.org
+++ b/README.org
@@ -46,3 +46,7 @@ hook list.
#+begin_src emacs-lisp
(add-hook 'org-mode-hook #'org-modern-mode)
#+end_src
+
+Note that =org-modern-mode= tries to adjust the tag label display based on the
+value of =line-spacing=. This looks best if =line-spacing= has a value between
0.1
+and 0.4 in the Org buffer.
diff --git a/org-modern.el b/org-modern.el
index 9651568f05..2f31ae296c 100644
--- a/org-modern.el
+++ b/org-modern.el
@@ -39,9 +39,29 @@
:group 'org
:prefix "org-modern-")
-(defcustom org-modern-line-spacing 7
- "Line spacing, should approximately match the box line width."
- :type '(choice (const nil) integer))
+(defvar org-modern-label-border)
+(defun org-modern--update-label-face ()
+ "Update border of the `org-modern-label' face."
+ (when (facep 'org-modern-label)
+ (set-face-attribute
+ 'org-modern-label nil :box
+ (when org-modern-label-border
+ (let ((border (if (eq org-modern-label-border 'auto)
+ (max 3 (cond
+ ((integerp line-spacing) line-spacing)
+ ((floatp line-spacing) (ceiling (*
line-spacing (frame-char-height))))
+ (t (/ (frame-char-height) 10))))
+ org-modern-label-border)))
+ `(:color ,(face-attribute 'default :background nil t) :line-width ,(-
border)))))))
+
+(defcustom org-modern-label-border 'auto
+ "Line width used for tag label borders.
+If set to `auto' the border width is computed based on the `line-spacing'.
+A value between 0.1 and 0.4 of `line-spacing' is recommended."
+ :type '(choice (const nil) integer)
+ :set (lambda (sym val)
+ (set sym val)
+ (org-modern--update-label-face)))
(defcustom org-modern-star ["◉""○""◈""◇""⁕"]
"Replacement strings for headline stars for each level.
@@ -134,8 +154,8 @@ Set to nil to disable the progress bar."
:inherit variable-pitch
:width condensed :weight regular
:underline nil
- ,@(and org-modern-line-spacing
- `(:box (:line-width ,(- org-modern-line-spacing))))))
+ ,@(and (integerp org-modern-label-border)
+ `(:box (:line-width ,(- org-modern-label-border))))))
"Parent face for labels.")
(defface org-modern-block-keyword
@@ -201,9 +221,6 @@ Set to nil to disable the progress bar."
(defvar-local org-modern--keywords nil
"List of font lock keywords.")
-(defvar-local org-modern--orig-line-spacing 'unset
- "Original line spacing.")
-
(defun org-modern--priority ()
"Prettify headline priorities using the `org-modern-priority' character."
(let ((beg (match-beginning 1))
@@ -404,18 +421,10 @@ Set to nil to disable the progress bar."
"Modern looks for Org."
:global nil
:group 'org-modern
- (unless (eq org-modern--orig-line-spacing 'unset)
- (setq line-spacing org-modern--orig-line-spacing
- org-modern--orig-line-spacing 'unset))
(cond
(org-modern-mode
- (when-let (width (plist-get (face-attribute 'org-modern-label :box)
:line-width))
- (set-face-attribute
- 'org-modern-label nil
- :box `(:color ,(face-attribute 'default :background nil t) :line-width
,width)))
+ (org-modern--update-label-face)
(setq
- org-modern--orig-line-spacing line-spacing
- line-spacing org-modern-line-spacing
org-modern--keywords
(append
(when-let (bullet (alist-get ?+ org-modern-list))
- [elpa] externals/org-modern a91b994721 11/65: Ensure that time stamps stay editable (Fix #2), (continued)
- [elpa] externals/org-modern a91b994721 11/65: Ensure that time stamps stay editable (Fix #2), ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern 6b1a560776 04/65: example: Add hrule, ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern 4071382aa0 03/65: Restore line spacing (Fix #1), ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern 2478748a91 02/65: Update README, ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern b66f3ff985 08/65: README: Note that the package is still early in its development., ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern ff1160a03c 07/65: org-modern-label: Fix line-spacing handling, ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern d28951932a 13/65: Ensure that tags stay editable (See #2), ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern be679b3a79 14/65: Improve cursor placement on TODO keywords, ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern a84994dc77 15/65: Improve cursor placement on timestamps (See #2), ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern b17d32c576 16/65: README rewording, ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern 6b925b71ee 19/65: Add org-modern-label-border, do not overwrite line-spacing,
ELPA Syncer <=
- [elpa] externals/org-modern 7ceca7a3cc 20/65: More beautiful checkboxes, ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern 58252d0955 21/65: Fix typo (Fix #4), ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern 8abe22886a 22/65: Improve checkboxes, ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern a37053e995 23/65: More elegant progress indicator, ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern 8a0bce9661 26/65: Blocks: Add wrap-prefix to support visual-line-mode, ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern 008f6baa8a 27/65: Improve block font locking, ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern a63a427991 28/65: Fix docstring, ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern d2bda1d449 29/65: Improve table editability, ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern d6e8889e32 31/65: Fix indented tables, ELPA Syncer, 2022/03/07
- [elpa] externals/org-modern f0532357fe 32/65: Handle upper case block keywords, ELPA Syncer, 2022/03/07