[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-remark f988330790 091/173: add: make-pen props work
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-remark f988330790 091/173: add: make-pen props work as intended |
Date: |
Fri, 28 Jan 2022 16:58:04 -0500 (EST) |
branch: externals/org-remark
commit f98833079021cfe366ca697312a39dd5b519f6e6
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>
add: make-pen props work as intended
---
org-marginalia.el | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/org-marginalia.el b/org-marginalia.el
index 27f7ab19b3..01f3c0ab8d 100644
--- a/org-marginalia.el
+++ b/org-marginalia.el
@@ -94,7 +94,7 @@ It is meant to exist only one of these in each Emacs
session.")
(defconst org-marginalia-prop-source-end "marginalia-source-end")
;;; Macros
-(defmacro org-marginalia-make-pen (label face &rest properties)
+(defmacro org-marginalia-make-pen (label face &optional properties)
"Create a user-defined highlight function.
LABEL is the name of the highlight. The function will be called
`ov-highlight-LABEL', and it will apply FACE to the selected
@@ -112,13 +112,16 @@ no arguments."
;; Add highlight to the text
(org-with-wide-buffer
(let ((face ,face)
- (properties (quote ,properties))
+ (properties ,properties)
(ov (make-overlay beg end nil 'FRONT-ADVANCE)))
(overlay-put ov 'face face)
(while properties
- (setq prop (pop properties)
- val (pop properties))
+ (setq prop (pop properties))
+ (setq val (pop properties))
(overlay-put ov prop val))
+
+ (overlay-put ov 'org-marginalia-label ,label)
+
(overlay-put ov 'org-marginalia-id id)
;; Keep track it in a local variable. It's a list overlays, guranteed
to
;; contain only marginalia overlays as opposed to the one returned by
@@ -136,7 +139,10 @@ no arguments."
(org-marginalia-housekeep)
(org-marginalia-sort-highlights-list)))
-(org-marginalia-make-pen "yellow" '(:background "Yellow") "category"
"important" "org-marginalia-label" "yellow")
+;; Don't use category (symbol) as a property -- it's a special one of text
+;; properties. If you use it, the value also need to be a symbol; otherwise,
you
+;; will get an error. You can use CATEGORY (symbol and all uppercase).
+(org-marginalia-make-pen "yellow" '(:background "Yellow") '(CATEGORY
"important"))
;;;; Commands
@@ -372,6 +378,7 @@ buffer"
(org-marginalia-sort-highlights-list)
;; Update the marginalia note file accordingly
(org-marginalia-remove-marginalia id arg)
+ (org-marginalia-housekeep)
t))
(defun org-marginalia-next ()
@@ -485,15 +492,6 @@ backlink feature for marginalia files."
(text (org-with-wide-buffer (buffer-substring-no-properties beg end)))
(props (overlay-properties highlight))
(note-props nil))
- (while props
- (let ((p (pop props))
- (v (pop props)))
- (when (and (stringp p)
- (or (string-equal "category" (downcase p))
- (and (>= (length p) 15)
- (string-equal "org-marginalia-" (downcase
(substring p 0 15))))))
- (push v note-props)
- (push p note-props))))
;; TODO Want to add a check if save is applicable here.
(with-current-buffer (find-file-noselect org-marginalia-notes-file-path)
;; If it is a new empty marginalia file
@@ -514,7 +512,7 @@ backlink feature for marginalia files."
(goto-char id-headline)
;; Update the existing headline and position properties
(org-edit-headline text)
- (org-marginalia-notes-set-properties nil beg end note-props)
+ (org-marginalia-notes-set-properties nil beg end props)
(org-set-property org-marginalia-prop-source-beg
(number-to-string beg))
(org-set-property org-marginalia-prop-source-end
@@ -530,7 +528,7 @@ backlink feature for marginalia files."
;; Create a headline
;; Add a properties
(insert (concat "** " text "\n"))
- (org-marginalia-notes-set-properties id beg end note-props)
+ (org-marginalia-notes-set-properties id beg end props)
(if (and org-marginalia-use-org-id orgid)
(insert (concat "[[id:" orgid "]" "[" title "]]"))
(insert (concat "[[file:" path "]" "[" title "]]")))))))
@@ -544,11 +542,13 @@ backlink feature for marginalia files."
(org-set-property org-marginalia-prop-source-end
(number-to-string end))
(while props
- ;; Upcase for the property names for Org It seems CATEGORY needs to be
- ;; uppercase for sparse tree search to work properly.
- (let ((p (upcase (pop props)))
+ (let ((p (pop props))
(v (pop props)))
- (org-set-property p v))))
+ (when (symbolp p) (setq p (symbol-name p)))
+ (when (or (string-equal "CATEGORY" (upcase p))
+ (and (>= (length p) 15)
+ (string-equal "org-marginalia-" (downcase (substring p 0
15)))))
+ (org-set-property p v)))))
(defun org-marginalia-list-highlights-positions (&optional reverse)
"Return list of beg points of highlights in this buffer.
- [elpa] externals/org-remark 6b0bbad4b3 070/173: feat: link with org-id (WIP), (continued)
- [elpa] externals/org-remark 6b0bbad4b3 070/173: feat: link with org-id (WIP), ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark a9acfcd106 077/173: doc: README for 0.0.6, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 57bd3ab847 078/173: add: tracking-save to local kill-buffer-hook, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark c1adffe077 082/173: docs: 0.0.6 docs, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 60cbbc4e99 083/173: Merge dev/0.0.6-revise, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 2d11de2ec2 085/173: docs: README, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 3037be5ebc 087/173: docs: update README with global-tracking-mode, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark b988d580d8 090/173: add: Create pen to have different colors, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 02d7b56265 088/173: fix: tracking does not save for the first file, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 7242c83d8f 094/173: copyright year, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark f988330790 091/173: add: make-pen props work as intended,
ELPA Syncer <=
- [elpa] externals/org-remark bdbde4eda8 093/173: refactor: macro to make different pen, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark b3a8e3e2ec 097/173: add: Org-HANA: Org to Highlight & ANnotate Any text file (HANA), ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark f7e796cd6b 095/173: chg: don't update headline text; various refactors, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 4ee9e23e50 100/173: intrnl: refactor fn names, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark ecb82aebbe 101/173: intrnl correct some minor errors, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark fd5cab5ac2 102/173: rm: org-marginalia*.el, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 51b0c08f25 104/173: docs: NEWS, README etc. for name change, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 0c6aad188a 106/173: doc:README minor change for grammar, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark a98120b18c 107/173: add ::line-number to file line, ELPA Syncer, 2022/01/28
- [elpa] externals/org-remark 366b169e55 108/173: add: pen-factory & available pens for change, ELPA Syncer, 2022/01/28