aboutsummaryrefslogtreecommitdiff
path: root/pearl.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-26 15:57:11 -0500
committerCraig Jennings <c@cjennings.net>2026-05-26 15:57:11 -0500
commit5bb933761568982b0e60621577038450bc3dc2bf (patch)
tree0f96e867d6ac59ba969bbddb9449b2f159dae46d /pearl.el
parent02d1c7b009f109a83a6c62ae56f4a3a9ba2d21e3 (diff)
downloadpearl-5bb933761568982b0e60621577038450bc3dc2bf.tar.gz
pearl-5bb933761568982b0e60621577038450bc3dc2bf.zip
feat(comments): dim read-only comments so they read as disabled
A comment you can't edit only had a grey heading, and the grey (`shadow`) was light enough to blend with the body text of your own comments. Now the read-only overlay covers the whole comment subtree, heading and body, so the comment recedes as a unit. And `pearl-readonly-comment` uses a darker background-aware grey (gray40 on a dark theme, gray60 on light, `shadow` as the fallback). Editable comments keep the heading-only overlay so your own comment text stays normal-colored, with the green heading as the "this one's yours" cue.
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)))))))