emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org-modern 5c46042666 36/65: Simplify org-modern--times


From: ELPA Syncer
Subject: [elpa] externals/org-modern 5c46042666 36/65: Simplify org-modern--timestamp
Date: Mon, 7 Mar 2022 12:57:47 -0500 (EST)

branch: externals/org-modern
commit 5c46042666dc0de292c2bdf2301dbbfcc0f23d20
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Simplify org-modern--timestamp
---
 org-modern.el | 33 +++++++++------------------------
 1 file changed, 9 insertions(+), 24 deletions(-)

diff --git a/org-modern.el b/org-modern.el
index 4112d4174b..d9d2df39cc 100644
--- a/org-modern.el
+++ b/org-modern.el
@@ -316,35 +316,20 @@ Set to nil to disable the indicator."
      (1- (match-end 0))
      (match-end 0)
      'display " ")
-    ;; year
+    ;; year-month-day
     (put-text-property
      (match-beginning 0)
-     (match-end 1)
+     (if (match-end 2) (match-end 1) (match-end 0))
      'face date-face)
-    ;; month
-    (put-text-property
-     (match-beginning 2)
-     (match-end 2)
-     'face date-face)
-    ;; day
-    (put-text-property
-     (match-beginning 3)
-     (if (match-end 4) (match-end 3) (match-end 0))
-     'face date-face)
-    (when (match-end 4)
+    (when (match-end 2)
+      ;; hour:minute
       (put-text-property
-       (match-beginning 4)
-       (1+ (match-beginning 4))
+       (match-beginning 2)
+       (1+ (match-beginning 2))
        'display (format #(" %c" 1 3 (cursor t))
-                        (char-after (match-beginning 4))))
-      ;; hour
-      (put-text-property
-       (match-beginning 4)
-       (match-end 4)
-       'face time-face)
-      ;; minute
+                        (char-after (match-beginning 2))))
       (put-text-property
-       (match-beginning 5)
+       (match-beginning 2)
        (match-end 0)
        'face time-face))))
 
@@ -470,7 +455,7 @@ Set to nil to disable the indicator."
       (when org-modern-tag
         '(("^\\*+.*?\\( \\)\\(:.*:\\)[ \t]*$" (0 (org-modern--tag)))))
       (when org-modern-timestamp
-        
'(("\\(?:<\\|\\[\\)\\([0-9]\\{4\\}-\\)\\([0-9]\\{2\\}-\\)\\([0-9]\\{2\\}\\(?: 
[A-Za-z]+\\)? ?\\)\\(?:\\([0-9]\\{2\\}:\\)\\([0-9]\\{2\\}\\)\\)?\\(?:>\\|\\]\\)"
+        '(("\\(?:<\\|\\[\\)\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\(?: 
[A-Za-z]+\\)? ?\\)\\([0-9]\\{2\\}:[0-9]\\{2\\}\\)?\\(?:>\\|\\]\\)"
            (0 (org-modern--timestamp)))))
       (when org-modern-statistics
         '((" \\[\\(\\([0-9]+\\)%\\|\\([0-9]+\\)/\\([0-9]+\\)\\)\\]" (0 
(org-modern--statistics)))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]