branch: elpa/annotate commit 2050c59af362295a2501d6ec73812e264350bc35 Author: cage <cage-invalid@invalid> Commit: cage <cage-invalid@invalid>
- marked buffer as unmodified when switching database and the only change occurred in a buffer was reloading the minor mode (annotate-mode); - updating Changelog, News and version number. --- Changelog | 7 ++++++- NEWS.org | 3 +++ README.org | 12 ++++++++++-- annotate.el | 15 +++++++++------ 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Changelog b/Changelog index 5b572e1e82..bfcb15ccf1 100644 --- a/Changelog +++ b/Changelog @@ -1,10 +1,15 @@ +2020-06-09 Bastian Bechtold, cage + * annotate.el (annotate-buffers-annotate-mode, annotate-switch-db) + - added functions to switch the database of annotations used for the emacs session; + - increased version to 0.7.1 + 2020-05-18 Bastian Bechtold, cage * annotate.el - Increased version to 0.7.0 for stable release 2020-01-25 Bastian Bechtold, cage - * annotate.el (defun annotate-annotation-force-newline-policy, + * annotate.el (annotate-annotation-force-newline-policy, annotate-annotation-newline-policy-forced-p, annotate-create-annotation, annotate-lineate, diff --git a/NEWS.org b/NEWS.org index 9c9f82552a..395afe503b 100644 --- a/NEWS.org +++ b/NEWS.org @@ -114,3 +114,6 @@ - 2020-05-18 V0.7.0 Bastian Bechtold, cage :: Increased version to 0.7.0 for stable release + +- 2020-06-09 V0.7.1 Bastian Bechtold, cage :: + The database of annotation can be changed using the command ~annotate-switch-db~. diff --git a/README.org b/README.org index a978e841f7..19c655be97 100644 --- a/README.org +++ b/README.org @@ -30,8 +30,16 @@ previous annotation. ** Metadata -All annotations are saved in ~annotate-file~ (=~/.annotations= by -default). +The current database for annotations is contained in the file +indicated by the variable ~annotate-file~ (=~/.emacs.d/annotations= by +default) but each user can change this value in a dynamic way using +the command ~annotate-switch-db~. This command will take care to +refresh/redraw all annotations in the buffers that uses +~annotate-mode~. + +Please note that switching database, in this context, means rebinding +the aforementioned variable (~annotate-file~). This means than no +more than a single database can be active for each Emacs session. Users of [[https://github.com/emacscollective/no-littering][no-littering]] diff --git a/annotate.el b/annotate.el index b690608e6d..9b7da0890a 100644 --- a/annotate.el +++ b/annotate.el @@ -7,7 +7,7 @@ ;; Maintainer: Bastian Bechtold ;; URL: https://github.com/bastibe/annotate.el ;; Created: 2015-06-10 -;; Version: 0.7.0 +;; Version: 0.7.1 ;; This file is NOT part of GNU Emacs. @@ -55,7 +55,7 @@ ;;;###autoload (defgroup annotate nil "Annotate files without changing them." - :version "0.7.0" + :version "0.7.1" :group 'text) ;;;###autoload @@ -2516,7 +2516,7 @@ code, always use load files from trusted sources!" (let ((new-db (read-file-name "Database file location: "))) (when (not (annotate-string-empty-p new-db)) (if (file-exists-p new-db) - (let* ((confirm-message "Loading elisp file from untrusted source may results in severe security problems. Load %S? [y/N]") + (let* ((confirm-message "Loading elisp file from untrusted source may results in severe security problems. Load %S? [y/N] ") (load-file-confirmed (if force-load t (string= (read-from-minibuffer (format confirm-message @@ -2527,9 +2527,12 @@ code, always use load files from trusted sources!" (setf annotate-file new-db) (cl-loop for annotated-buffer in (annotate-buffers-annotate-mode) do (with-current-buffer annotated-buffer - (annotate-with-inhibit-modification-hooks - (annotate-mode -1) - (annotate-mode 1))))) + (let ((buffer-was-modified-p (buffer-modified-p annotated-buffer))) + (annotate-with-inhibit-modification-hooks + (annotate-mode -1) + (annotate-mode 1) + (when (not buffer-was-modified-p) + (set-buffer-modified-p nil))))))) (message "Load aborted by the user"))) (user-error (format "The file %S does not exists." new-db))))))