aboutsummaryrefslogtreecommitdiff
path: root/pearl.el
diff options
context:
space:
mode:
Diffstat (limited to 'pearl.el')
-rw-r--r--pearl.el28
1 files changed, 19 insertions, 9 deletions
diff --git a/pearl.el b/pearl.el
index 0cac082..33265ef 100644
--- a/pearl.el
+++ b/pearl.el
@@ -4444,8 +4444,11 @@ resolves to a single label."
:group 'pearl)
(defface pearl-readonly-comment
- '((t :inherit shadow))
- "Face for comment headings the current user cannot edit."
+ '((((background dark)) :foreground "gray40")
+ (((background light)) :foreground "gray60")
+ (t :inherit shadow))
+ "Face for comments the current user cannot edit, dimmed to read as disabled.
+Darker than the stock `shadow' grey so a read-only comment clearly recedes."
:group 'pearl)
(defun pearl--comment-editable-p (author-id viewer-id)
@@ -4524,19 +4527,26 @@ unlike `issueDelete' this is not a recoverable soft delete."
(defun pearl--apply-comment-highlights (viewer-id)
"Color every comment heading in the buffer by editability for VIEWER-ID.
-The viewer's own comments get `pearl-editable-comment'; all others get
-`pearl-readonly-comment'. Idempotent: clears prior highlights first."
+The viewer's own comments get `pearl-editable-comment' on the heading line; all
+others get `pearl-readonly-comment' over the whole comment subtree (heading and
+body) so a comment you cannot edit reads as disabled. Idempotent: clears prior
+highlights first."
(save-excursion
(remove-overlays (point-min) (point-max) 'pearl-comment t)
(goto-char (point-min))
(while (re-search-forward "^\\*+ " nil t)
(let ((comment-id (org-entry-get nil "LINEAR-COMMENT-ID")))
(when comment-id
- (let* ((author-id (org-entry-get nil "LINEAR-COMMENT-AUTHOR-ID"))
- (face (if (pearl--comment-editable-p author-id viewer-id)
- 'pearl-editable-comment
- 'pearl-readonly-comment))
- (ov (make-overlay (line-beginning-position) (line-end-position))))
+ (let* ((editable (pearl--comment-editable-p
+ (org-entry-get nil "LINEAR-COMMENT-AUTHOR-ID")
+ viewer-id))
+ (face (if editable 'pearl-editable-comment 'pearl-readonly-comment))
+ ;; Editable: heading line only, so your own comment text reads
+ ;; normally. Read-only: the whole subtree, dimming the body too.
+ (end (if editable
+ (line-end-position)
+ (save-excursion (org-end-of-subtree t t) (point))))
+ (ov (make-overlay (line-beginning-position) end)))
(overlay-put ov 'pearl-comment t)
(overlay-put ov 'face face)))))))