[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/annotate 3239275a5b 265/372: - fitted 'annotate-position-i
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/annotate 3239275a5b 265/372: - fitted 'annotate-position-inside-chain-p' into |
Date: |
Fri, 4 Feb 2022 16:59:06 -0500 (EST) |
branch: elpa/annotate
commit 3239275a5b99a91b33ebfc0b2720469fd36f5742
Author: cage <cage-invalid@invalid>
Commit: cage <cage-invalid@invalid>
- fitted 'annotate-position-inside-chain-p' into
'annotate--position-inside-annotated-text-p';
- fixed some typos.
---
annotate.el | 85 ++++++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 56 insertions(+), 29 deletions(-)
diff --git a/annotate.el b/annotate.el
index 6a0903378c..0e899fa243 100644
--- a/annotate.el
+++ b/annotate.el
@@ -178,7 +178,7 @@ database is not filtered at all."
:group 'annotate)
(defcustom annotate-use-echo-area nil
- "Whether annotation text should apperar in the echo area only when mouse
+ "Whether annotation text should appear 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
@@ -309,7 +309,7 @@ annotation as defined in the database."
(setf inhibit-modification-hooks ,old-mode)))))
(cl-defmacro annotate-with-restore-modified-bit (&rest body)
- "Save the value of `buffer-modified-p' before `body' is exectuted
+ "Save the value of `buffer-modified-p' before `body' is executed
and restore the saved value just after the end of `body'."
(let ((modifiedp (gensym)))
`(let ((,modifiedp (buffer-modified-p)))
@@ -434,11 +434,59 @@ modified (for example a newline is inserted)."
"Is 'overlay' an annotation?"
(annotate-overlay-filled-p overlay))
-(defun annotate--position-inside-annotated-text-p (pos)
+(defun annotate--position-on-annotated-text-p (pos)
+ "Does `pos' (as buffer position) corresponds to a character
+that belong to some annotated text?"
(let ((annotation (annotate-annotation-at pos)))
(if annotation
t
- (annotate-position-inside-chain-p pos))))
+ ;; there is a chance that a point do not belong text rendered as
+ ;; annotated but belong to a chain anyway
+ ;; example:
+ ;;
+ ;; legend:
+ ;; a = annotated text
+ ;; * = non annotated text
+ ;; # = annotation
+ ;;
+ ;; Create a multiline annotation using region.
+ ;;
+ ;; aaaa
+ ;; aaaa
+ ;; aaaa
+ ;;
+ ;;
+ ;; aaaa
+ ;; aaaa
+ ;; aaaa ####
+ ;;
+ ;; place the cursor here:
+ ;;
+ ;; aaaa
+ ;; aaaa
+ ;; ^ cursor
+ ;; aaaa ####
+ ;;
+ ;; type some text
+ ;;
+ ;; aaaa
+ ;; *****
+ ;; aaaa ####
+ ;;
+ ;; the text (the asterisks) is not rendered as annotated but as
+ ;; annotations can not have gaps so we enforce this limitation
+ ;; and consider it still parts of a chain formed by the
+ ;; surrounding annotated text.
+ (let* ((previous-annotation (annotate-previous-annotation-ends pos))
+ (next-annotation (annotate-next-annotation-starts pos))
+ (previous-chain (annotate-chain-first previous-annotation))
+ (next-chain (annotate-chain-first next-annotation)))
+ (if (and previous-chain
+ next-chain
+ (eq previous-chain
+ next-chain))
+ t
+ nil)))))
(defun annotate-annotate ()
"Create, modify, or delete annotation."
@@ -462,8 +510,8 @@ modified (for example a newline is inserted)."
(cond
(annotations
(signal 'annotate-annotate-region-overlaps annotations))
- ((or (annotate--position-inside-annotated-text-p region-beg)
- (annotate--position-inside-annotated-text-p region-stop))
+ ((or (annotate--position-on-annotated-text-p region-beg)
+ (annotate--position-on-annotated-text-p region-stop))
(signal 'annotate-annotate-region-overlaps nil))
(t
(create-new-annotation)))))
@@ -471,7 +519,7 @@ modified (for example a newline is inserted)."
(annotate-change-annotation (point))
(font-lock-fontify-buffer nil))
(t
- (if (annotate--position-inside-annotated-text-p (point))
+ (if (annotate--position-on-annotated-text-p (point))
(signal 'annotate-annotate-region-overlaps nil)
(create-new-annotation))))
(set-buffer-modified-p t))))
@@ -1392,7 +1440,7 @@ annotation."
In this context annotation means annotation loaded from local
database not the annotation shown in the buffer (therefore these
arguments are 'record' as called in the other database-related
-funcions).
+functions).
"
(< (annotate-beginning-of-annotation a)
(annotate-beginning-of-annotation b)))
@@ -1508,27 +1556,6 @@ in a chain of annotations as first"
in a chain of annotations as last"
(annotate-annotation-chain-position annotation
annotate-prop-chain-pos-marker-last))
-(defun annotate-position-inside-chain-p (pos)
- "Returns non nil if `pos' is a position in a buffer inside a chain."
- (let ((chain-first (annotate-chain-first-at pos))
- (chain-last (annotate-chain-last-at pos)))
- (if (and chain-first ;; pos belongs to a chain
- chain-last)
- t
- ;; there is a chance that a point do not belong to a chain but
- ;; it is surrounded by two annotations that are part of the same
- ;; chain
- (let* ((previous-annotation (annotate-previous-annotation-ends pos))
- (next-annotation (annotate-next-annotation-starts pos))
- (previous-chain (annotate-chain-first previous-annotation))
- (next-chain (annotate-chain-first next-annotation)))
- (if (and previous-chain
- next-chain
- (eq previous-chain
- next-chain))
- t
- nil)))))
-
(defun annotate-find-chain (annotation)
"Find all annotation that are parts of the chain where `annotation' belongs"
(annotate-ensure-annotation (annotation)
- [nongnu] elpa/annotate 412053cefc 173/372: - [bugfix] When a window is resized ensure that the sizes are, (continued)
- [nongnu] elpa/annotate 412053cefc 173/372: - [bugfix] When a window is resized ensure that the sizes are, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 41e85c8435 176/372: - increased version number;, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate cc4292cce4 181/372: - moved the test for 'limit' up in the lambda of the filtering, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate f4cc83ec84 189/372: Merge branch 'master' into org-mode-fix, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate bcffdb9f24 202/372: - added some missing docstrings., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 99c45f553e 225/372: Merge pull request #67 from cage2/new-stable-version, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate d4b555d237 242/372: Merge pull request #76 from cage2/master, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate a04a6144aa 240/372: Merge pull request #75 from cage2/master, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate a4607c4184 273/372: - updated version and documentation., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate daf4c3c726 283/372: - removed code, in integration procedures, that should never runs., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 3239275a5b 265/372: - fitted 'annotate-position-inside-chain-p' into,
ELPA Syncer <=
- [nongnu] elpa/annotate b68170837e 279/372: - fixed the width of the last row of the box, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 958ce126e0 272/372: - fixed more typos., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate d55c48f508 304/372: changed function from 'font-lock-fontify-buffer' to 'font-lock-ensure'., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 876f1425d2 310/372: - removed another useless argument from call to 'font-lock-flush'., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate cc9393c6bd 318/372: - when annotationg a newline, replace annotation if a single one, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 92434b63ff 323/372: - improved documentation and fixed indentation for a couple of local functions., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate a45584c53f 358/372: - removed customizable function 'annotate-y-or-n-prompt-function'., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 07667d4ccb 314/372: - updated version number in top comment block., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 641daae9d0 335/372: - updated docs and version number., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate b74bade94c 345/372: - increased version number., ELPA Syncer, 2022/02/04