[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-real a040280 003/160: Added primary slot to color l
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-real a040280 003/160: Added primary slot to color last element in url |
Date: |
Wed, 6 Oct 2021 16:58:03 -0400 (EDT) |
branch: externals/org-real
commit a040280126217531cb96c9cf0929dc6c03edf444
Author: Tyler Grinn <tylergrinn@gmail.com>
Commit: Tyler Grinn <tylergrinn@gmail.com>
Added primary slot to color last element in url
---
org-real.el | 35 +++++++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/org-real.el b/org-real.el
index edeeca6..13b08de 100644
--- a/org-real.el
+++ b/org-real.el
@@ -26,7 +26,10 @@
:type org-real--box)
(children :initarg :children
:initform '()
- :type list)))
+ :type list)
+ (primary :initarg :primary
+ :initform nil
+ :type boolean)))
(defvar org-real-prepositions
'("in" "behind" "in front of" "above" "below" "to the left of" "to the right
of"))
@@ -81,11 +84,13 @@
(oset box :parent prev)
(object-add-to-list prev :children box)
(if containers
- (org-real--create-box containers prev box)))
+ (org-real--create-box containers prev box)
+ (oset box :primary t)))
(oset box :parent parent)
(object-add-to-list parent :children box)
(if containers
- (org-real--create-box containers parent box))))))
+ (org-real--create-box containers parent box)
+ (oset box :primary t))))))
(defun org-real--parse-url (str)
"Parse URL into an org real object"
@@ -131,13 +136,22 @@
(org-real--draw box offset)
(special-mode)))))
+(defface org-real-primary
+ '((t :background "aquamarine"
+ :foreground "black"))
+ "Face for the last thing in a url"
+ :group 'org-real)
+
(defun org-real--pp-text (containers)
(let* ((reversed (reverse containers))
- (container (pop reversed)))
+ (container (pop reversed))
+ (primary-name (plist-get container :name)))
(dotimes (_ (cdr org-real--padding)) (insert "\n"))
(insert (make-string (car org-real--padding) ?\s))
(insert "The ")
- (insert (plist-get container :name))
+ (put-text-property 0 (length primary-name) 'face 'org-real-primary
+ primary-name)
+ (insert primary-name)
(if reversed (insert " is"))
(while reversed
(insert " ")
@@ -158,10 +172,14 @@
(name (oref box :name))
(children (oref box :children))
(dashed (oref box :behind))
- (align-bottom (oref box :in-front)))
- (cl-flet ((draw (coords str)
+ (align-bottom (oref box :in-front))
+ (primary (oref box :primary)))
+ (cl-flet ((draw (coords str &optional primary)
(goto-line (car coords))
(move-to-column (cdr coords) t)
+ (if primary
+ (put-text-property 0 (length str) 'face
'org-real-primary
+ str))
(insert str)
(delete-char (length str))))
(draw (cons top left)
@@ -173,7 +191,8 @@
(concat "└" (make-string (- width 2) (if dashed #x254c
#x2500)) "┘")))
(draw (cons (+ top 1 (cdr org-real--padding))
(+ left 1 (car org-real--padding)))
- name)
+ name
+ primary)
(let ((r (+ top 1))
(c1 left)
(c2 (+ left width -1)))
- [elpa] branch externals/org-real created (now ab46371), ELPA Syncer, 2021/10/06
- [elpa] externals/org-real a040280 003/160: Added primary slot to color last element in url,
ELPA Syncer <=
- [elpa] externals/org-real cad260e 002/160: Removed unused box slot, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real b2dcbfc 001/160: initial commit, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 49c8920 008/160: Removed server stage from ci/cd, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real f281b65 010/160: Typo, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real e0eac63 019/160: Updated preposition list, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 735ce86 028/160: Cleaned up hooks, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 4fe5b9f 036/160: Renamed md5 command, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 0974b67 023/160: Make changes to satisfy elc compiler, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 4c2915a 033/160: Updated README, ELPA Syncer, 2021/10/06
- [elpa] externals/org-real 89d616e 024/160: Check compilation during ci/cd pipeline, ELPA Syncer, 2021/10/06