From c883750174d8976d47445ce330b8c1399b5fd36d Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sun, 26 Apr 2026 18:34:01 +0200 Subject: [PATCH] update annotate --- elpa/annotate-20251111.1635/README-elpa | 15 +++ .../annotate-autoloads.el | 4 +- .../annotate-pkg.el | 6 +- .../annotate.el | 123 +++++++++--------- 4 files changed, 83 insertions(+), 65 deletions(-) create mode 100644 elpa/annotate-20251111.1635/README-elpa rename elpa/{annotate-20250515.1428 => annotate-20251111.1635}/annotate-autoloads.el (96%) rename elpa/{annotate-20250515.1428 => annotate-20251111.1635}/annotate-pkg.el (69%) rename elpa/{annotate-20250515.1428 => annotate-20251111.1635}/annotate.el (98%) diff --git a/elpa/annotate-20251111.1635/README-elpa b/elpa/annotate-20251111.1635/README-elpa new file mode 100644 index 00000000..c02f9331 --- /dev/null +++ b/elpa/annotate-20251111.1635/README-elpa @@ -0,0 +1,15 @@ +This package provides the minor mode annotate-mode, which can add +annotations to arbitrary files without changing the files +themselves. Annotations are saved in the annotate-file +(~/.annotations by default). + +To add annotations to a file, select a region and hit C-c C-a. The +region will be underlined, and the annotation will be displayed in +the right margin. Annotations are saved whenever the file is saved. + +Use C-c ] to jump to the next annotation and C-c [ to jump to +the previous annotation. Use M-x annotate-export-annotations to +save annotations as a no-difference diff file. + +Important note for developers: annotation can not overlaps and newline character +can not be annotated. diff --git a/elpa/annotate-20250515.1428/annotate-autoloads.el b/elpa/annotate-20251111.1635/annotate-autoloads.el similarity index 96% rename from elpa/annotate-20250515.1428/annotate-autoloads.el rename to elpa/annotate-20251111.1635/annotate-autoloads.el index 95e4a982..1a7051fa 100644 --- a/elpa/annotate-20250515.1428/annotate-autoloads.el +++ b/elpa/annotate-20251111.1635/annotate-autoloads.el @@ -12,8 +12,8 @@ ;;; Generated autoloads from annotate.el (let ((loads (get 'annotate 'custom-loads))) (if (member '"annotate" loads) nil (put 'annotate 'custom-loads (cons '"annotate" loads)) (put 'text 'custom-loads (cons 'annotate (get 'text 'custom-loads))))) -(autoload 'annotate-mode "annotate" "\ -Toggle Annotate mode. +(autoload 'annotate-mode "annotate" +"Toggle Annotate mode. See https://github.com/bastibe/annotate.el/ for documentation. diff --git a/elpa/annotate-20250515.1428/annotate-pkg.el b/elpa/annotate-20251111.1635/annotate-pkg.el similarity index 69% rename from elpa/annotate-20250515.1428/annotate-pkg.el rename to elpa/annotate-20251111.1635/annotate-pkg.el index 3aa255ac..92a22bb8 100644 --- a/elpa/annotate-20250515.1428/annotate-pkg.el +++ b/elpa/annotate-20251111.1635/annotate-pkg.el @@ -1,9 +1,9 @@ ;; -*- no-byte-compile: t; lexical-binding: nil -*- -(define-package "annotate" "20250515.1428" +(define-package "annotate" "20251111.1635" "Annotate files without changing them." '((emacs "27.1")) :url "https://github.com/bastibe/annotate.el" - :commit "dc6e884265c9de5b0e486b9f6bd9509a14b85c94" - :revdesc "dc6e884265c9" + :commit "9c80b465297dce20901abaf0389a48951b6e030f" + :revdesc "9c80b465297d" :maintainers '(("Bastian Bechtold" . "bastibe.dev@mailbox.org") ("cage" . "cage-dev@twistfold.it"))) diff --git a/elpa/annotate-20250515.1428/annotate.el b/elpa/annotate-20251111.1635/annotate.el similarity index 98% rename from elpa/annotate-20250515.1428/annotate.el rename to elpa/annotate-20251111.1635/annotate.el index 090a9072..e49eb253 100644 --- a/elpa/annotate-20250515.1428/annotate.el +++ b/elpa/annotate-20251111.1635/annotate.el @@ -7,8 +7,8 @@ ;; Maintainer: Bastian Bechtold , cage ;; URL: https://github.com/bastibe/annotate.el ;; Created: 2015-06-10 -;; Package-Version: 20250515.1428 -;; Package-Revision: dc6e884265c9 +;; Package-Version: 20251111.1635 +;; Package-Revision: 9c80b465297d ;; Package-Requires: ((emacs "27.1")) ;; This file is NOT part of GNU Emacs. @@ -60,7 +60,7 @@ ;;;###autoload (defgroup annotate nil "Annotate files without changing them." - :version "2.4.2" + :version "2.4.5" :group 'text) (defvar annotate-mode-map @@ -418,6 +418,13 @@ in the customizable colors lists: (when (= ,read-mode-p 1) (read-only-mode 1))))) +(defun annotate-file-exists-p (filepath) + "Returns nil if the file pointed by `FILEPATH' does not exists +or an error occurs during the test +(e.g TRAMP mode fails to connect to remote server)." + (with-demoted-errors "Error: %S" + (file-exists-p filepath))) + (defun annotate-annotations-exist-p () "Does this buffer contains at least one or more annotations?" (cl-find-if 'annotationp @@ -1599,11 +1606,6 @@ text will be discarded." ;;; database related procedures -(defun annotate-info-actual-filename () - "The info filename that feed this buffer or nil if not this -buffer is not on info-mode" - (annotate-guess-filename-for-dump Info-current-file nil)) - (cl-defun annotate-indirect-buffer-p (&optional (buffer (current-buffer))) "Returns non nil if BUFFER (default the current buffer) is an indirect buffer." (buffer-base-buffer buffer)) @@ -1612,24 +1614,13 @@ buffer is not on info-mode" "Returns non nil if the current buffer is an indirect buffer." (annotate-indirect-buffer-p)) -(defun annotate-actual-file-name () - "Get the actual file name of the current buffer." - (cond - ((annotate-indirect-buffer-current-p) - nil) - (t - (substring-no-properties (or (annotate-info-actual-filename) - (buffer-file-name) - (buffer-file-name (buffer-base-buffer)) - ""))))) - (cl-defun annotate-guess-filename-for-dump (filename &optional (return-filename-if-not-found-p t)) "Guess an acceptable file name suitable for metadata database from FILENAME." (cond ((annotate-string-empty-p filename) nil) - ((file-exists-p filename) + ((annotate-file-exists-p filename) filename) (t (let ((found (if return-filename-if-not-found-p @@ -1638,11 +1629,29 @@ buffer is not on info-mode" (cl-block surrounding (dolist (extension annotate-info-valid-file-extensions) (let ((filename-maybe (concat filename extension))) - (when (file-exists-p filename-maybe) + (when (annotate-file-exists-p filename-maybe) (setf found filename-maybe) (cl-return-from surrounding found))))) found)))) +(defun annotate-info-actual-filename () + "The info filename that feed this buffer or nil if not this +buffer is not on info-mode" + (annotate-guess-filename-for-dump Info-current-file nil)) + +(defun annotate-actual-file-name () + "Get the actual file name of the current buffer." + (cond + ((annotate-indirect-buffer-current-p) + nil) + (t + (let ((visited-filename (when (buffer-file-name) + (abbreviate-file-name (buffer-file-name))))) + (substring-no-properties (or (annotate-info-actual-filename) + visited-filename + (buffer-file-name (buffer-base-buffer)) + "")))))) + (defun annotate-make-annotation-dump-entry (filename file-annotations checksum) "Make an annotation record: see `annotate-load-annotations'." (list filename @@ -1950,34 +1959,28 @@ annotation." (let ((db (annotate-db-clean-records (annotate-load-annotation-data t)))) (annotate-dump-annotation-data db))) -(defun annotate--expand-record-path (record) - "Expand file component of RECORD." - (let* ((short-filename (annotate-filename-from-dump record)) - (annotations (annotate-annotations-from-dump record)) - (file-checksum (annotate-checksum-from-dump record)) - (expandp (not (or (file-remote-p short-filename) - (annotate-info-root-dir-p short-filename)))) - (actual-filename (if expandp - (expand-file-name short-filename) - short-filename))) - (annotate-make-record actual-filename - annotations - file-checksum))) - (defun annotate--deserialize-database-file (file) "Return a sexp from the annotation database contained in FILE." - (with-temp-buffer - (let* ((annotations-file file) - (attributes (file-attributes annotations-file))) - (cond - ((not (file-exists-p annotations-file)) - (signal 'annotate-db-file-not-found (list annotations-file))) - ((= (file-attribute-size attributes) - 0) - nil) - (t - (insert-file-contents annotations-file) - (mapcar #'annotate--expand-record-path (read (current-buffer)))))))) + (cl-flet ((deserialize-record (record) + "deserialize `RECORD' form its sexp form." + (let* ((filename (annotate-filename-from-dump record)) + (annotations (annotate-annotations-from-dump record)) + (file-checksum (annotate-checksum-from-dump record))) + (annotate-make-record filename + annotations + file-checksum)))) + (with-temp-buffer + (let* ((annotations-file file) + (attributes (file-attributes annotations-file))) + (cond + ((not (annotate-file-exists-p annotations-file)) + (signal 'annotate-db-file-not-found (list annotations-file))) + ((= (file-attribute-size attributes) + 0) + nil) + (t + (insert-file-contents annotations-file) + (mapcar #'deserialize-record (read (current-buffer))))))))) (defun annotate-load-annotation-data (&optional ignore-errors) "Read and returns saved annotations." @@ -1991,17 +1994,17 @@ annotation." ((or save-empty-db data) (with-temp-file annotate-file + (cl-flet ((%make-record (annotation) + (let ((full-filename (annotate-filename-from-dump annotation)) + (annotations (annotate-annotations-from-dump annotation)) + (file-checksum (annotate-checksum-from-dump annotation))) + (annotate-make-record (abbreviate-file-name full-filename) + annotations + file-checksum)))) (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) + (actual-data (mapcar #'%make-record data))) + (prin1 actual-data (current-buffer)))))) + ((annotate-file-exists-p annotate-file) (let* ((confirm-message "Delete annotations database file %S? ") (delete-confirmed-p (or (not annotate-database-confirm-deletion) (y-or-n-p (format confirm-message annotate-file))))) @@ -3041,7 +3044,7 @@ results can be filtered with a simple query language: see (1- annotation-end)) (clean-snippet (buffer-string)))) (build-snippet (filename annotation-begin annotation-end) - (if (file-exists-p filename) + (if (annotate-file-exists-p filename) (cond ((eq (annotate-guess-file-format filename) :info) @@ -3647,7 +3650,7 @@ code, always use load files from trusted sources!" (let ((new-db (or database-file-path (read-file-name "Database file location: ")))) (when (not (annotate-string-empty-p new-db)) - (if (file-exists-p new-db) + (if (annotate-file-exists-p new-db) (let* ((confirm-message "Loading elisp file from untrusted source may results in severe security problems. Load %S?") (load-file-confirmed (or force-load (y-or-n-p (format confirm-message new-db))))) @@ -3767,7 +3770,7 @@ their personal database." (remove-non-existing-files (annotations) (cl-remove-if-not (lambda (a) (let ((filename (annotate-filename-from-dump a))) - (file-exists-p filename))) + (annotate-file-exists-p filename))) annotations))) (let* ((confirm-message (concat "Importing databases from untrusted source may cause severe " "security issues, continue?")) -- 2.47.3