[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/annotate d1237bb158 07/13: - shown a warning when killing
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/annotate d1237bb158 07/13: - shown a warning when killing an indirect buffer; |
Date: |
Fri, 16 Sep 2022 11:58:22 -0400 (EDT) |
branch: elpa/annotate
commit d1237bb1586032a430f06b9045e4c35ad6f9a4f9
Author: cage <cage>
Commit: cage <cage@invalid>
- shown a warning when killing an indirect buffer;
- reverted code in initialization procedure.
---
annotate.el | 33 +++++++++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/annotate.el b/annotate.el
index bccdf40350..006c1c9379 100644
--- a/annotate.el
+++ b/annotate.el
@@ -130,6 +130,10 @@ that Emacs passes to the diff program."
"Whether status messages may appear in the minibuffer."
:type 'boolean)
+(defcustom annotate-popup-warning-indirect-buffer t
+ "Whether an information popup message is shown when killing an annotated
indirect buffer."
+ :type 'boolean)
+
(defcustom annotate-integrate-marker " ANNOTATION: "
"Marker that is written before every integrated annotation."
:type 'string)
@@ -245,6 +249,16 @@ an annotations could not be restored.")
"The message to warn the user that a buffer it is not visiting
a valid file to be annotated.")
+(defconst annotate-popup-warn-killing-an-indirect-buffer
+ (concat "You killed an indirect buffer that contains annotation.\n"
+ "Annotate mode can not save annotation in an indirect buffer.\n"
+ "The buffer's content has been saved in a regular buffer "
+ "(together with its annotations) named:\n\n%S\n\n"
+ "If you want you can save that buffer in a file and "
+ "the annotations will be saved as well.")
+ "The message to warn the user that an annotated indirect buffer
+ has been killed.")
+
(defconst annotate-error-summary-win-filename-invalid
"Error: File not found or in an unsupported format"
"The message to warn the user that file can not be show in
@@ -342,7 +356,8 @@ See `annotate-blacklist-major-mode'."
(annotate-shutdown)
(setq annotate-mode nil))
(annotate-mode
- (annotate-initialize))
+ (when (not (annotate-annotations-exist-p))
+ (annotate-initialize)))
(t
(annotate-shutdown)))))
@@ -1466,6 +1481,12 @@ essentially what you get from:
(with-current-buffer new-buffer
(annotate-mode -1)
(insert indirect-content)
+ ;; when launching the command `(annotate-mode 1)' annotate
+ ;; mode refuses to add the hooks if annotations are already
+ ;; present in the buffer.
+ ;; So the right way here is: first activate the mode and then
+ ;; add the annotations
+ (annotate-mode 1)
(cl-loop for annotation in annotations do
(let ((annotation-start (annotate-beginning-of-annotation
annotation))
(annotation-end (annotate-ending-of-annotation
annotation))
@@ -1474,7 +1495,15 @@ essentially what you get from:
annotation-end
annotation-text
nil)))
- (annotate-mode 1)))))
+ (pop-to-buffer new-buffer)
+ (let* ((info-message (message
annotate-popup-warn-killing-an-indirect-buffer
+ (buffer-name new-buffer)))
+ (user-choice (when annotate-popup-warning-indirect-buffer
+ (x-popup-dialog t (list info-message
+ (cons "OK" :ok)
+ (cons "Never show
again" :bury))))))
+ (when (eq user-choice :bury)
+ (customize-save-variable 'annotate-popup-warning-indirect-buffer
nil)))))))
(defun annotate-save-annotations ()
"Save all annotations to disk."
- [nongnu] elpa/annotate updated (0f4ffd5c1c -> f166cca70b), ELPA Syncer, 2022/09/16
- [nongnu] elpa/annotate f92e7ff48e 09/13: - updated NEWS.org., ELPA Syncer, 2022/09/16
- [nongnu] elpa/annotate d1237bb158 07/13: - shown a warning when killing an indirect buffer;,
ELPA Syncer <=
- [nongnu] elpa/annotate e044f6d898 03/13: - updated Changelog., ELPA Syncer, 2022/09/16
- [nongnu] elpa/annotate 145719fe7b 02/13: - increased version number;, ELPA Syncer, 2022/09/16
- [nongnu] elpa/annotate 51e3f6248e 08/13: - updated, and added if missing, docstrings., ELPA Syncer, 2022/09/16
- [nongnu] elpa/annotate d611b272e5 10/13: - removed a duplicated label using a constant., ELPA Syncer, 2022/09/16
- [nongnu] elpa/annotate f166cca70b 13/13: Merge pull request #135 from cage2/fix-closing-indirect-buffer, ELPA Syncer, 2022/09/16
- [nongnu] elpa/annotate ce49471b20 05/13: - returned nil as the actual filename of an indirect buffer., ELPA Syncer, 2022/09/16
- [nongnu] elpa/annotate 51ae976d39 01/13: - fixed an error that was signalled when the annotated buffer was an indirect one., ELPA Syncer, 2022/09/16
- [nongnu] elpa/annotate f8286fb24d 12/13: - updated changelog., ELPA Syncer, 2022/09/16
- [nongnu] elpa/annotate 5f39830efc 06/13: - create a proper buffer from an indirect one that has been annotated., ELPA Syncer, 2022/09/16
- [nongnu] elpa/annotate e4a266fbb0 11/13: - removed a duplicated label using a constant., ELPA Syncer, 2022/09/16