[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/annotate 8ac52808e8 226/372: - added a couple of functions
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/annotate 8ac52808e8 226/372: - added a couple of functions to allow an user to change the file that |
Date: |
Fri, 4 Feb 2022 16:59:02 -0500 (EST) |
branch: elpa/annotate
commit 8ac52808e82274b1a905200b06602e3d901f018f
Author: cage <cage-invalid@invalid>
Commit: cage <cage-invalid@invalid>
- added a couple of functions to allow an user to change the file that
contains the database of annotation, and reload all the annotated
buffers.
---
annotate.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/annotate.el b/annotate.el
index e138fa924e..b690608e6d 100644
--- a/annotate.el
+++ b/annotate.el
@@ -2489,5 +2489,51 @@ annotation, like this:
;;;; end of filtering: parser, lexer, etc.
+;;;; switching database
+
+(defun annotate-buffers-annotate-mode ()
+ "Returns a list of all the buffers that have
+annotate minor mode active"
+ (let ((all-buffers (buffer-list)))
+ (cl-labels ((annotate-mode-p (buffer)
+ (with-current-buffer buffer
+ (and (boundp 'annotate-mode)
+ annotate-mode))))
+ (cl-remove-if-not #'annotate-mode-p all-buffers))))
+
+(cl-defun annotate-switch-db (&optional (force-load nil))
+ "Ask the user for a new annotation database files, load it and
+refresh all the annotations contained in each buffer where
+annotate minor mode is active.
+
+If `force-load' is non nil no prompt asking user for confirmation
+about loading the new file is shown.
+
+Note: this function will attempt to load (compile and
+eval/execute) the content of the file as it was elisp source
+code, always use load files from trusted sources!"
+ (interactive)
+ (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]")
+ (load-file-confirmed (if force-load
+ t
+ (string= (read-from-minibuffer (format
confirm-message
+
new-db))
+ "y"))))
+ (if load-file-confirmed
+ (progn
+ (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)))))
+ (message "Load aborted by the user")))
+ (user-error (format "The file %S does not exists." new-db))))))
+
+;; end of switching database
+
(provide 'annotate)
;;; annotate.el ends here
- [nongnu] elpa/annotate c7891d8d24 163/372: - tried to make the file more "site friendly"., (continued)
- [nongnu] elpa/annotate c7891d8d24 163/372: - tried to make the file more "site friendly"., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate ec0ed147a2 170/372: - fixed error for regexp search in 'annotate--font-lock-matcher', ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 1525550f85 182/372: - changed test for annotation rejection and removed (maybe) useless check., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 2e858729cb 200/372: - saving annotations with newlines seems to works;, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 31e3c24726 195/372: - updated version and documentation, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate e933d84692 214/372: - fixed removing of annotation in 'annotate-before-change-fn', ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate e03edfb2c2 218/372: - increased version number;, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate e2c365a376 222/372: - added reference to the issue., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 44b378b16a 219/372: Merge pull request #62 from cage2/master, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate f0a71bb148 223/372: Merge pull request #64 from cage2/fix-face-detection, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 8ac52808e8 226/372: - added a couple of functions to allow an user to change the file that,
ELPA Syncer <=
- [nongnu] elpa/annotate 9ea6c4fc71 247/372: - signalled errors when query parsing errors occurs., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate cc0b5da6c1 229/372: Merge pull request #69 from cage2/switch-database, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 914c9ee5b9 264/372: Fixed a regression and some bugs related to incorrect calculation of, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 0b71184865 269/372: - updated changelog., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 3b4ee73c8d 275/372: - stored abbreviated filenames for the path component of each record, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate c4a56cc33d 306/372: - added missing argument to 'annotate-create-annotation'., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 9fc6d7a839 311/372: - allowed deleting of annotations for info files., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 54ac759fac 315/372: Merge pull request #99 from cage2/remove-some-compilation-warnings, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 4ae1d4f2a6 346/372: Merge pull request #112 from cage2/clean-style, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 8471cdaa7c 328/372: - updated Changelog., ELPA Syncer, 2022/02/04