new Patch attached!
>From e1e96baf89a9d28e1748b8a747b9452b16d425ac Mon Sep 17 00:00:00 2001 From: pavodive <[email protected]> Date: Tue, 12 May 2026 13:50:57 -0500 Subject: [PATCH] lisp/org.el: Add an overlay to distinclty show links in comments
* org.el (org-activate-links): Added an overlay to the visible part of the link in a commented-out line, so it shows distinctly. * org-faces.el (org-link-comment): Created a new face used to display links when they are in commented lines. TINYCHANGE Reported-by: "Max Nikulin" <[email protected]> Link: https://list.orgmode.org/orgmode/[email protected]/ --- lisp/org-faces.el | 8 ++++++++ lisp/org.el | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/lisp/org-faces.el b/lisp/org-faces.el index b0f5ef9d7..851d6be11 100644 --- a/lisp/org-faces.el +++ b/lisp/org-faces.el @@ -183,6 +183,14 @@ set the properties in the `org-column' face. For example, set "Face for links." :group 'org-faces) +(defface org-link-comment + '((t :inherit (font-lock-comment-face org-link))) + "Face for Org links that appear inside comment lines. +Inherits from both `org-link' and `font-lock-comment-face' so the +link remains visually distinct from regular links while still +signaling that it lives in commented-out text." + :group 'org-faces) + (defface org-footnote '((((class color) (background light)) (:foreground "Purple" :underline t)) (((class color) (background dark)) (:foreground "Cyan" :underline t)) diff --git a/lisp/org.el b/lisp/org.el index cb36497f4..ef3ab593c 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5560,6 +5560,7 @@ prompted for." (defun org-activate-links (limit) "Add link properties to links. This includes angle, plain, and bracket links." + (remove-overlays (point) limit 'org-link-comment t) (catch :exit (while (re-search-forward org-link-any-re limit t) (let* ((start (match-beginning 0)) @@ -5628,6 +5629,12 @@ This includes angle, plain, and bracket links." (let ((f (org-link-get-parameter type :activate-func))) (when (functionp f) (funcall f start end path (eq style 'bracket)))) + ;; If the link is on a comment line, put an overlay + ;; on the visible part so it displays disticntly. + (when (org-at-comment-p) + (let ((ov (make-overlay visible-start visible-end))) + (overlay-put ov 'face 'org-link-comment) + (overlay-put ov 'org-link-comment t))) (throw :exit t)) ;signal success ;; Not a real link, move forward one char and repeat the search. (goto-char (1+ (match-beginning 0)))))) -- 2.34.1
PavoDive <[email protected]> writes: > Thanks for the patience and for the suggestions! > > Christian Moe <[email protected]> writes: > >> With one exception, none of the other face names in org-faces.el end in >> "-face". (Exception: org-agenda-dimmed-todo-face, for some reason.) > You're right, I didn't pay much attention to the style, but these > things are important for consistency. I'll rename it to something that > is similar to the other face names. > >> Great, but I think you forgot to add font-lock-comment-face to the >> :inherit list (where I think it needs to go first to work). > > Right again. > >> I think you can make do with >> >> (when (org-at-comment-p) > > and yet again! > > I'll re-write the patch and email it again. -- PavoDive
