[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/annotate 3268944bbd 03/14: - added command 'annotate-chang
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/annotate 3268944bbd 03/14: - added command 'annotate-change-annotation-text-position'. |
Date: |
Wed, 20 Mar 2024 10:00:00 -0400 (EDT) |
branch: elpa/annotate
commit 3268944bbd2835805e53c5f012b2c38020555cc1
Author: cage <cage>
Commit: cage <cage@invalid>
- added command 'annotate-change-annotation-text-position'.
---
annotate.el | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/annotate.el b/annotate.el
index c0a5a66e47..ee89bdb7a5 100644
--- a/annotate.el
+++ b/annotate.el
@@ -179,6 +179,9 @@ placed on the right margin of the window instead of its own
line
after the annotated text."
:type 'number)
+(defconst annotate-allowed-positioning-policy
+ '(:by-length :margin :new-line))
+
(defcustom annotate-annotation-position-policy :by-length
"Policy for annotation's position:
- :new-line
@@ -933,6 +936,22 @@ and
(goto-char (overlay-end chain-last)))
(annotate-goto-previous-annotation :startingp t)))))
+(defun annotate-change-annotation-text-position ()
+ (interactive)
+ (when-let ((annotation (annotate-annotation-at (point))))
+ (let ((current-position (annotate-annotation-get-position annotation)))
+ (if (null current-position)
+ (annotate-annotation-set-position annotation
+ (cl-first
annotate-allowed-positioning-policy))
+ (when-let ((current-position-index (cl-position current-position
+
annotate-allowed-positioning-policy))
+ (next-position-index (mod (1+ current-position-index)
+ (length
annotate-allowed-positioning-policy))))
+ (annotate-annotation-set-position annotation
+ (elt
annotate-allowed-positioning-policy
+ next-position-index)))))
+ (font-lock-flush)))
+
(defun annotate-actual-comment-start ()
"String for comment start related to current buffer's major
mode."
@@ -1334,7 +1353,7 @@ a a**"
(lambda (x y)
(< (overlay-end x) (overlay-end y)))))
;; configure each annotation's properties and place it on the
- ;; the window. The actual position of the annotation (newline
+ ;; the window. The default position of the annotation (newline
;; or right margin) is indicated by the value of the
;; variable: `annotate-annotation-position-policy'.
(dolist (ov overlays)
@@ -1350,6 +1369,8 @@ a a**"
(setf position-new-line-p t))
(:by-length
(setf position-new-line-p nil))
+ (:margin
+ (setf position-new-line-p :margin))
(otherwise
nil)))
(let* ((annotation-long-p (> (string-width
(annotate-annotation-get-annotation-text ov))
@@ -1365,7 +1386,8 @@ a a**"
bol
eol
position-new-line-p))
- (annotation-stopper (if position-new-line-p
+ (annotation-stopper (if (and position-new-line-p
+ (not (eq position-new-line-p
:margin)))
(if (= overlays-counter
(length overlays))
"\n"
@@ -1380,7 +1402,8 @@ a a**"
(when (and (not annotate-use-echo-area)
(not hidden-text)
(annotate-chain-last-p ov))
- (when position-new-line-p
+ (when (and position-new-line-p
+ (not (eq position-new-line-p :margin)))
(setf prefix-first " \n"))
(dolist (l multiline-annotation)
(setq annotation-text
@@ -2275,7 +2298,7 @@ and `annotate-color-index-from-dump' to specify
annotation appearance."
all-faces-height))
(when force-newline-p
(annotate-annotation-set-position annotation :new-line)))
- annotation))))
+ annotation)))
(if (annotate-string-empty-p annotation-text)
(signal 'annotate-empty-annotation-text-error t)
(progn
@@ -2285,7 +2308,7 @@ and `annotate-color-index-from-dump' to specify
annotation appearance."
(if (and text-to-match
(string= text-to-match annotated-text))
(create-annotation start end annotation-text)
- (let* ((starting-point-matching (go-backward start))
+ (let* ((starting-point-macthing (go-backward start))
(ending-point-match (go-forward start))
(length-match (- end start))
(new-match (guess-match-and-add
starting-point-matching
- [nongnu] elpa/annotate 0f6064f162 08/14: - updated docstrings., (continued)
- [nongnu] elpa/annotate 0f6064f162 08/14: - updated docstrings., ELPA Syncer, 2024/03/20
- [nongnu] elpa/annotate 6ee1d936db 07/14: - fixed variable name., ELPA Syncer, 2024/03/20
- [nongnu] elpa/annotate 201e1c7e96 13/14: - updated NEWS., ELPA Syncer, 2024/03/20
- [nongnu] elpa/annotate 9d88cc7ffe 14/14: Merge pull request #160 from cage2/master, ELPA Syncer, 2024/03/20
- [nongnu] elpa/annotate 44577f237c 02/14: - allowed different positioning of annotated text on the same buffer., ELPA Syncer, 2024/03/20
- [nongnu] elpa/annotate dd6165ba32 05/14: - fixed wrapping of annotation in a 'box'., ELPA Syncer, 2024/03/20
- [nongnu] elpa/annotate 782c5f7dca 09/14: - updated README., ELPA Syncer, 2024/03/20
- [nongnu] elpa/annotate 666fb32177 04/14: - fixed position policy layout in builder., ELPA Syncer, 2024/03/20
- [nongnu] elpa/annotate 9e885741f5 06/14: - added new command 'annotate-change-annotation-color';, ELPA Syncer, 2024/03/20
- [nongnu] elpa/annotate 5b63a89874 10/14: - changed keybinding for 'annotate-change-annotation-text-position';, ELPA Syncer, 2024/03/20
- [nongnu] elpa/annotate 3268944bbd 03/14: - added command 'annotate-change-annotation-text-position'.,
ELPA Syncer <=
- [nongnu] elpa/annotate 9aa27cadf7 11/14: - increased version number., ELPA Syncer, 2024/03/20
- [nongnu] elpa/annotate 8a8e2cd282 12/14: - updated changelog., ELPA Syncer, 2024/03/20