branch: elpa/annotate commit f33eecba7bed92fd84145d0b473c52d417690c95 Author: cage <cage@invalid> Commit: cage <cage@invalid>
- prevented asking to delete a database that does not actually exists on the file system; - marked as modified the buffer when an annotation is deleted. --- annotate.el | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/annotate.el b/annotate.el index cac2992623..ff17a77a37 100644 --- a/annotate.el +++ b/annotate.el @@ -1584,19 +1584,21 @@ annotation." (defun annotate-dump-annotation-data (data &optional save-empty-db) "Save `data' into annotation file." - (if (or save-empty-db - data) - (with-temp-file annotate-file - (let* ((print-length nil) - (%abbreviate-filename (lambda (record) - (let ((full-filename (annotate-filename-from-dump record)) - (annotations (annotate-annotations-from-dump record)) - (file-checksum (annotate-checksum-from-dump record))) - (annotate-make-record (abbreviate-file-name full-filename) - annotations - file-checksum)))) - (actual-data (mapcar %abbreviate-filename data))) - (prin1 actual-data (current-buffer)))) + (cond + ((or save-empty-db + data) + (with-temp-file annotate-file + (let* ((print-length nil) + (%abbreviate-filename (lambda (record) + (let ((full-filename (annotate-filename-from-dump record)) + (annotations (annotate-annotations-from-dump record)) + (file-checksum (annotate-checksum-from-dump record))) + (annotate-make-record (abbreviate-file-name full-filename) + annotations + file-checksum)))) + (actual-data (mapcar %abbreviate-filename data))) + (prin1 actual-data (current-buffer))))) + ((file-exists-p annotate-file) (let* ((confirm-message "Delete annotations database file %S? [y/N] ") (delete-confirmed-p (or (not annotate-database-confirm-deletion) (string= (read-from-minibuffer (format confirm-message @@ -1607,7 +1609,7 @@ annotation." (delete-file annotate-file t) (error (message "error removing annotation database: %S" (error-message-string err)))) - (annotate-dump-annotation-data data t))))) + (annotate-dump-annotation-data data t)))))) (cl-defmacro with-matching-annotation-fns ((filename beginning @@ -2108,7 +2110,7 @@ point)." (when-let ((annotation (annotate-annotation-at point))) (let* ((delete-confirmed-p (annotate--confirm-annotation-delete))) (when delete-confirmed-p - (annotate--delete-annotation-chain-prevent-modification annotation))))) + (annotate--delete-annotation-chain annotation))))) (defun annotate-change-annotation (pos) "Change annotation at point. If empty, delete annotation."