[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/annotate c972641056 258/372: - Using "help-echo" to print
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/annotate c972641056 258/372: - Using "help-echo" to print annotations instead of render it on the buffer. |
Date: |
Fri, 4 Feb 2022 16:59:05 -0500 (EST) |
branch: elpa/annotate
commit c972641056ddcc1d8ef2c8cf1a89ab30e9f6505d
Author: cage <cage-invalid@invalid>
Commit: cage <cage-invalid@invalid>
- Using "help-echo" to print annotations instead of render it on the buffer.
This feature is optional and can be activated using the customizable
variable 'annotate-use-echo-area'
---
annotate.el | 86 +++++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 58 insertions(+), 28 deletions(-)
diff --git a/annotate.el b/annotate.el
index dfd1251392..511bc53214 100644
--- a/annotate.el
+++ b/annotate.el
@@ -177,6 +177,13 @@ database is not filtered at all."
:type 'symbol
:group 'annotate)
+(defcustom annotate-use-echo-area nil
+ "Whether annotation text should apperar in the echo area only when mouse
+id positioned over the annotated text instead of positioning them in
+the the buffer (the default)."
+ :type 'boolean
+ :group 'annotate)
+
(defconst annotate-prop-chain-position
'position)
@@ -381,10 +388,14 @@ modified (for example a newline is inserted)."
(add-hook 'window-configuration-change-hook 'font-lock-fontify-buffer t t)
(add-hook 'before-change-functions 'annotate-before-change-fn t t)
(add-hook 'Info-selection-hook 'annotate-info-select-fn t t)
- (font-lock-add-keywords
- nil
- '((annotate--font-lock-matcher (2 (annotate--annotation-builder))
- (1 (annotate--change-guard))))))
+ (if annotate-use-echo-area
+ (font-lock-add-keywords
+ nil
+ '((annotate--font-lock-matcher (2 (annotate--annotation-builder)))))
+ (font-lock-add-keywords
+ nil
+ '((annotate--font-lock-matcher (2 (annotate--annotation-builder))
+ (1 (annotate--change-guard)))))))
(defun annotate-shutdown ()
"Clear annotations and remove save and display hooks."
@@ -393,10 +404,14 @@ modified (for example a newline is inserted)."
(remove-hook 'window-configuration-change-hook 'font-lock-fontify-buffer t)
(remove-hook 'before-change-functions 'annotate-before-change-fn t)
(remove-hook 'Info-selection-hook 'annotate-info-select-fn t)
- (font-lock-remove-keywords
- nil
- '((annotate--font-lock-matcher (2 (annotate--annotation-builder))
- (1 (annotate--change-guard))))))
+ (if annotate-use-echo-area
+ (font-lock-remove-keywords
+ nil
+ '((annotate--font-lock-matcher (2 (annotate--annotation-builder)))))
+ (font-lock-remove-keywords
+ nil
+ '((annotate--font-lock-matcher (2 (annotate--annotation-builder))
+ (1 (annotate--change-guard)))))))
(defun annotate-overlay-filled-p (overlay)
"Does this overlay contains an 'annotation' property?"
@@ -911,25 +926,27 @@ to 'maximum-width'."
(overlay-put ov
'face
(overlay-get first-in-chain 'face))))
- (when (annotate-chain-last-p ov)
- (when position-new-line-p
- (setf prefix-first " \n"))
- (dolist (l multiline-annotation)
- (setq annotation-text
- (concat annotation-text
- prefix-first
- (propertize l 'face face)
- annotation-stopper))
- ;; white space before for all but the first annotation line
- (if position-new-line-p
- (setq prefix-first (concat prefix-first prefix-rest))
- (setq prefix-first prefix-rest))))))
- ;; build facespec with the annotation text as display property
- (if (string= annotation-text "")
- ;; annotation has been removed: remove display prop
- (list 'face 'default 'display nil)
- ;; annotation has been changed/added: change/add display prop
- (list 'face 'default 'display annotation-text))))))
+ (when (and (not annotate-use-echo-area)
+ (annotate-chain-last-p ov))
+ (when position-new-line-p
+ (setf prefix-first " \n"))
+ (dolist (l multiline-annotation)
+ (setq annotation-text
+ (concat annotation-text
+ prefix-first
+ (propertize l 'face face)
+ annotation-stopper))
+ ;; white space before for all but the first annotation line
+ (if position-new-line-p
+ (setq prefix-first (concat prefix-first prefix-rest))
+ (setq prefix-first prefix-rest))))))
+ (when (not annotate-use-echo-area)
+ ;; build facespec with the annotation text as display property
+ (if (string= annotation-text "")
+ ;; annotation has been removed: remove display prop
+ (list 'face 'default 'display nil)
+ ;; annotation has been changed/added: change/add display prop
+ (list 'face 'default 'display annotation-text)))))))
(defun annotate--remove-annotation-property (begin end)
"Cleans up annotation properties associated with a region."
@@ -1523,6 +1540,8 @@ The searched interval can be customized setting the
variable:
(highlight (make-overlay start
end-overlay)))
(overlay-put highlight 'face
'annotate-highlight)
(overlay-put highlight 'annotation
annotation-text)
+ (annotate-overlay-maybe-set-help-echo highlight
+
annotation-text)
(annotate-annotation-chain-position highlight
annotate-prop-chain-pos-marker-last)
(push highlight all-overlays))))))
@@ -1629,6 +1648,16 @@ The searched interval can be customized setting the
variable:
(goto-char end)
(font-lock-fontify-block 1))))))
+(defun annotate-overlay-put-echo-help (overlay text)
+ (overlay-put overlay 'help-echo text))
+
+(defun annotate-overlay-get-echo-help (overlay text)
+ (overlay-get overlay 'help-echo))
+
+(defun annotate-overlay-maybe-set-help-echo (overlay annotation-text)
+ (when annotate-use-echo-area
+ (annotate-overlay-put-echo-help overlay annotation-text)))
+
(defun annotate-change-annotation (pos)
"Change annotation at point. If empty, delete annotation."
(let* ((highlight (annotate-annotation-at pos))
@@ -1646,7 +1675,8 @@ The searched interval can be customized setting the
variable:
(change (annotation)
(let ((chain (annotate-find-chain annotation)))
(dolist (single-element chain)
- (overlay-put single-element 'annotation
annotation-text)))))
+ (annotate-overlay-maybe-set-help-echo single-element
annotation-text)
+ (overlay-put single-element 'annotation
annotation-text)))))
(save-excursion
(cond
;; annotation was cancelled:
- [nongnu] elpa/annotate 085791450c 215/372: - changed version number., (continued)
- [nongnu] elpa/annotate 085791450c 215/372: - changed version number., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate c72e730ba3 217/372: - fixed annotation picking in 'annotate-annotate', ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate a38a2ff6b4 221/372: - updated version and documentation., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate bb8cda2edc 238/372: - actually changed version number., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate e2fed2fbcf 246/372: - removed useless spaces., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 85520c0202 228/372: - fixed version number., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 3f0c28cab6 241/372: - fixed a bug that allowed to create an annotation with an empty text., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 2050c59af3 227/372: - marked buffer as unmodified when switching database and the only, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 99d99e5bcb 234/372: Merge pull request #72 from cage2/master, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 4b2fa8f61e 252/372: - removed function 'annotate-load-annotation-data-ignore-errors'., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate c972641056 258/372: - Using "help-echo" to print annotations instead of render it on the buffer.,
ELPA Syncer <=
- [nongnu] elpa/annotate 9320918b91 270/372: Merge pull request #84 from cage2/fix-regression-multiline-annotations, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 3e70e187b3 262/372: - updated NEWS and Changelog., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 4af196ce04 312/372: - updated Changelog and NEWS.org., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 3a4dc507c2 305/372: - removed unused functions., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 3458b548f4 303/372: - removed warning related to misplaced '(interactive)', ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate ed5f00d51c 351/372: - increased version number., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate ffd6bbcc11 340/372: - allowed paths with spaces in a search query., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate b9c908f24c 365/372: Merge pull request #115 from cage2/fix-delete-ghost-db, ELPA Syncer, 2022/02/04