[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/annotate 9cdc2a90fb 350/372: - added prompt to confirm del
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/annotate 9cdc2a90fb 350/372: - added prompt to confirm deletion also when deleting annotation's text; |
Date: |
Fri, 4 Feb 2022 16:59:21 -0500 (EST) |
branch: elpa/annotate
commit 9cdc2a90fbcad5904a900957b8cf9bd2868f6cb2
Author: cage <cage@localhost>
Commit: cage <cage@invalid>
- added prompt to confirm deletion also when deleting annotation's text;
- updated README.org.
---
README.org | 31 +++++++++++++++++++++++--------
annotate.el | 23 ++++++++++++++++-------
2 files changed, 39 insertions(+), 15 deletions(-)
diff --git a/README.org b/README.org
index eabe5b8ec6..0d3cfea760 100644
--- a/README.org
+++ b/README.org
@@ -22,8 +22,8 @@ is active, ~C-c C-a~ will create, edit, or delete annotations.
With an active region, ~C-c C-a~ creates a new annotation for that
region. With no active region, ~C-c C-a~ will create an annotation for
the word under point. If point is on an annotated region, ~C-c C-a~
-will edit that annotation instead of creating a new one. Clearing the
-annotation deletes them.
+will edit that annotation instead of creating a new one. Typing ~C-c
+C-d~ or clearing the annotation deletes them.
Use ~C-c ]~ to jump to the next annotation and ~C-c [~ to jump to the
previous annotation.
@@ -76,6 +76,10 @@ can take advantage of its packages generated files
management.
will edit that annotation instead of creating a new one. Clearing the
annotation deletes them.
+ If ~annotate-annotation-confirm-deletion~ is non nil (the default)
+ a confirmation action is asked to the user before actually remove
+ the annotation.
+
If point is the newline character and the customizable variable
~annotate-endline-annotate-whole-line~ is not nil (default is non
nil) the whole line is annotated (or the next if the line is
@@ -87,14 +91,25 @@ can take advantage of its packages generated files
management.
will signal an error.
**** related customizable variable
- - ~annotate-endline-annotate-whole-line~
- - ~annotate-highlight~;
- - ~annotate-highlight-secondary~;
- - ~annotate-annotation~;
- - ~annotate-annotation-secondary~;
- ~annotate-annotation-column~;
+ - ~annotate-annotation-confirm-deletion~;
- ~annotate-annotation-max-size-not-place-new-line~;
- - ~annotate-annotation-position-policy~.
+ - ~annotate-annotation-position-policy~;
+ - ~annotate-annotation-secondary~;
+ - ~annotate-annotation~;
+ - ~annotate-endline-annotate-whole-line~;
+ - ~annotate-highlight-secondary~;
+ - ~annotate-highlight~.
+
+*** ~C-c C-d~
+ Delete an annotation under point, if such annotation exists.
+
+ If ~annotate-annotation-confirm-deletion~ is non nil (the default)
+ a confirmation action is asked to the user before actually remove
+ the annotation.
+
+**** related customizable variable
+ - ~annotate-annotation-confirm-deletion~.
*** ~C-c ]~ (function annotate-goto-next-annotation)
Jump to the next annotation.
diff --git a/annotate.el b/annotate.el
index 038e7bc198..b9de71e708 100644
--- a/annotate.el
+++ b/annotate.el
@@ -2084,22 +2084,29 @@ from a chain where `annotation' belong."
(defun annotate--delete-annotation-chain-prevent-modification (annotation)
"Delete an annotation chain backing up and restoring modification
-status of the buffer before deltion occured."
+status of the buffer before deletion occured.
+
+This function is not part of the public API."
(annotate-ensure-annotation (annotation)
(annotate-with-restore-modified-bit
(annotate--delete-annotation-chain annotation))))
+(defun annotate--confirm-annotation-delete ()
+ "Prompt user for delete confirmation.
+This function is not part of the public API."
+ (let ((confirm-message "Delete this annotation? [y/N] "))
+ (or (not annotate-annotation-confirm-deletion)
+ (string= (read-from-minibuffer (format confirm-message
+ annotate-file))
+ "y"))))
+
(cl-defun annotate-delete-annotation (&optional (point (point)))
"Command to delete an annotation, `point' is the buffer
position where to look for annotation (default the cursor
point)."
(interactive)
(when-let ((annotation (annotate-annotation-at point)))
- (let* ((confirm-message "Delete this annotation? [y/N] ")
- (delete-confirmed-p (or (not annotate-annotation-confirm-deletion)
- (string= (read-from-minibuffer (format
confirm-message
-
annotate-file))
- "y"))))
+ (let* ((delete-confirmed-p (annotate--confirm-annotation-delete)))
(when delete-confirmed-p
(annotate--delete-annotation-prevent-modification annotation)))))
@@ -2119,7 +2126,9 @@ point)."
((null annotation-text))
;; annotation was erased:
((string= "" annotation-text)
- (annotate--delete-annotation-prevent-modification highlight))
+ (let* ((delete-confirmed-p (annotate--confirm-annotation-delete)))
+ (when delete-confirmed-p
+ (annotate--delete-annotation-prevent-modification highlight))))
;; annotation was changed:
(t
(change highlight)))))))
- [nongnu] elpa/annotate 0ae5752526 161/372: Merge pull request #54 from cage2/annotations-on-their-own-line, (continued)
- [nongnu] elpa/annotate 0ae5752526 161/372: Merge pull request #54 from cage2/annotations-on-their-own-line, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate c21b95273e 177/372: Merge pull request #57 from cage2/master, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 2ccdad1504 193/372: - starting with a new method to render multiline annotations, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 71f316be2f 236/372: - added dependency on 'info'., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 7a96192be2 248/372: - according to documentation the secon argument of 'signal' must be a list., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate f2b085d279 288/372: - fixed typos., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 26ea8e3631 266/372: - prevented getting shared value for 'annotate-file' in '%load-annotation-data'., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate b505af0f27 300/372: - updated NEWS, Changelog and version number., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 17958167da 298/372: Merge pull request #96 from cage2/master, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 784df37cba 313/372: - updated version number., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 9cdc2a90fb 350/372: - added prompt to confirm deletion also when deleting annotation's text;,
ELPA Syncer <=
- [nongnu] elpa/annotate 3e0d5f39b2 302/372: Merge pull request #98 from cage2/master, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate cb8212830d 317/372: - added feature when the customizable variable, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate ff3a0089e0 330/372: Merge pull request #102 from cage2/prevent-prompt-annotating-newline, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 1a09f78be9 322/372: - added comments to local functions of 'annotate-annotate'., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 1e7bc9c886 364/372: - updated Changelog., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 5bc3415d56 353/372: - used 'yes-or-no-p' (customizable via a variable) to ask for deletion confirm., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate eaf96d584f 349/372: - added confirmation prompt before delete an annotation., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate e37820134f 332/372: - updated NEWS, Changelog and version number., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 2f4cbcdb3d 324/372: - fixed indentation., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate c737b516b8 361/372: Merge pull request #114 from cage2/master, ELPA Syncer, 2022/02/04