branch: externals/org-remark
commit ca648a18767418b5b3774daa3a9720b472743bf0
Author: Noboru Ota <[email protected]>
Commit: Noboru Ota <[email protected]>
fix: change now can only select pens from the same type
Changing from the range-highlight to line-highlight and vice versa must
not be possible. This would break the begin end properties.
---
org-remark.el | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/org-remark.el b/org-remark.el
index 9e8cb1d8b4..18fb9dd5ac 100644
--- a/org-remark.el
+++ b/org-remark.el
@@ -622,15 +622,27 @@ and the current source buffer."
This function will show you a list of available pens to choose
from."
(interactive)
- (when-let* ((ov (org-remark-find-overlay-at-point))
- (id (overlay-get ov 'org-remark-id))
- (beg (overlay-start ov))
- (end (overlay-end ov)))
- (let ((new-pen (if pen pen
- (intern
- (completing-read "Which pen?:"
org-remark-available-pens)))))
- (org-remark-highlight-clear ov)
- (funcall new-pen beg end id :change))))
+ (if-let* ((ov (org-remark-find-dwim))
+ (id (overlay-get ov 'org-remark-id))
+ (beg (overlay-start ov))
+ (end (overlay-end ov)))
+ (let* ((available-pens (seq-filter
+ (lambda (pen-fn)
+ (let ((type (overlay-get ov 'org-remark-type)))
+ (eql type (function-get pen-fn
'org-remark-type))))
+ org-remark-available-pens))
+ (new-pen
+ (if pen pen
+ (intern
+ ;; To guard against minibuffer quit error when
+ ;; the user quit without selecting any pen.
+ (unwind-protect
+ (completing-read "Which pen?:"
+ available-pens))))))
+ (org-remark-highlight-clear ov)
+ (funcall new-pen beg end id :change))
+ ;; if ov or any other variables are not found
+ (message "No highlight here.")))
(defun org-remark-remove (point &optional delete)
"Remove the highlight at POINT.