branch: externals/org-remark
commit 39970252611acb18b5b227e04b6ed5f46a5b8086
Author: Noboru Ota <[email protected]>
Commit: Noboru Ota <[email protected]>
feat: icons for line-hl get their default face when notes exit
---
org-remark-icon.el | 12 ++++++++++--
org-remark-line.el | 16 ++++++++++++----
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/org-remark-icon.el b/org-remark-icon.el
index 39f5ffa809..fa66d31401 100644
--- a/org-remark-icon.el
+++ b/org-remark-icon.el
@@ -5,7 +5,7 @@
;; Author: Noboru Ota <[email protected]>
;; URL: https://github.com/nobiot/org-remark
;; Created: 29 July 2023
-;; Last modified: 14 August 2023
+;; Last modified: 18 August 2023
;; Package-Requires: ((emacs "27.1") (org "9.4"))
;; Keywords: org-mode, annotation, note-taking, marginal-notes, wp
@@ -196,11 +196,19 @@ of them. All it needs to do is to return a string that
represents
an icon, typically propertized with a face."
(let ((icon (symbol-value (intern (concat "org-remark-icon-"
(symbol-name icon-name)))))
- (highlight-face (overlay-get highlight 'face))
+ (highlight-face (org-remark-icon-highlight-get-face
+ highlight
+ (overlay-get highlight 'org-remark-type)))
(default-face default-face))
(if (functionp icon)
(funcall icon icon-name highlight-face default-face)
(propertize icon 'face (if default-face default-face highlight-face)))))
+(cl-defgeneric org-remark-icon-highlight-get-face (highlight _org-remark-type)
+ "Return the face of the HIGHLIGHT overlay.
+This is default method for range-highlights."
+ (overlay-get highlight 'face))
+
+
(provide 'org-remark-icon)
;;; org-remark-icon.el ends here
diff --git a/org-remark-line.el b/org-remark-line.el
index b6452ef848..79a314b94b 100644
--- a/org-remark-line.el
+++ b/org-remark-line.el
@@ -241,14 +241,22 @@ Return nil when no window is created for current buffer."
(cond (display-prop
(let* ((display-prop (list '(margin left-margin) display-prop))
(icon-string (propertize " " 'display display-prop)))
- (setq icon-string (propertize icon-string
- 'face
'org-remark-line-highlighter))
+ ;; (setq icon-string (propertize icon-string
+ ;; 'face
'org-remark-line-highlighter))
(overlay-put ov 'before-string icon-string)))
(icon-string
- (let ((icon-string (propertize icon-string
- 'face
'org-remark-line-highlighter)))
+ (let ((icon-string icon-string))
+ ;;(propertize icon-string
+ ;; 'face
'org-remark-line-highlighter)))
(overlay-put ov 'before-string (propertize " " 'display (list
'(margin left-margin) icon-string)))))
(t (ignore))))))
+
+(cl-defmethod org-remark-icon-highlight-get-face (highlight (_org-remark-type
(eql 'line)))
+ "Return the face of the line-highilght in a margin."
+ (get-text-property 0 'face
+ (cadr (get-text-property 0 'display
+ (overlay-get highlight
'before-string)))))
+
(provide 'org-remark-line)
;;; org-remark-line.el ends here