From 2e735a1052984299337decc6648ac02034d1263b Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 10 Jul 2023 12:53:08 +1000 Subject: Show link target in help-echo --- wiki-markup.el | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'wiki-markup.el') diff --git a/wiki-markup.el b/wiki-markup.el index 63bec0e..341610a 100644 --- a/wiki-markup.el +++ b/wiki-markup.el @@ -98,20 +98,26 @@ (while (re-search-forward link-re limit t) (let ((start (match-beginning 0)) (end (match-end 0)) - (visible-start (or (match-beginning 2) (match-beginning 1))) - (visible-end (or (match-end 2) (match-end 1))) + (target-start (match-beginning 1)) + (target-end (match-end 1)) + (label-start (or (match-beginning 2) (match-beginning 1))) + (label-end (or (match-end 2) (match-end 1))) (title (buffer-substring-no-properties (match-beginning 1) (match-end 1))) ) - (put-text-property start visible-start 'invisible t) + (put-text-property start label-start 'invisible t) (make-text-button start end 'action 'wiki-follow-wikilink-action 'button-data `((title . ,title))) + (put-text-property start end 'help-echo + (format "LINK: %s" + (buffer-substring-no-properties + target-start target-end))) (add-face-text-property start end 'org-link) - (put-text-property visible-end end 'invisible t) - (add-text-properties (1- visible-start) visible-start + (put-text-property label-end end 'invisible t) + (add-text-properties (1- label-start) label-start '(rear-nonsticky (invisible))) - (add-text-properties (1- visible-end) visible-end + (add-text-properties (1- label-end) label-end '(rear-nonsticky (invisible))) )))) -- cgit v1.2.3