[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/annotate 17958167da 298/372: Merge pull request #96 from c
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/annotate 17958167da 298/372: Merge pull request #96 from cage2/master |
Date: |
Fri, 4 Feb 2022 16:59:10 -0500 (EST) |
branch: elpa/annotate
commit 17958167dadcfaac19307013368d1a90f6680bad
Merge: 4890d2d2a2 4abf492f05
Author: cage2 <1257703+cage2@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
Merge pull request #96 from cage2/master
Added early checking encrypted (GPG) file format
---
Changelog | 19 +++++++++++++++++++
NEWS.org | 5 +++++
annotate.el | 31 +++++++++++++++++++++++++++----
3 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/Changelog b/Changelog
index 8312e68feb..eda6db44cf 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,22 @@
+2021-01-15 cage
+
+ * annotate.el:
+
+ - added checking encrypted (GPG) file format.
+
+ In many parts of the code we use 'annotate-guess-file-format', a
+ function that try to guess the format of the file that produced
+ the contents of a buffer.
+
+ Sometimes (for example buffers that shows info nodes) this check
+ is very expensive because involves reading (and possibly
+ decompress or even decrypt) the file contents and check for a
+ regular expression.
+
+ If we could know in advance that the file is symmetrically
+ encrypted with GPG we could skip other, more expensive checks for
+ guessing file format (like info files).
+
2021-01-14 cage
* annotate.el:
diff --git a/NEWS.org b/NEWS.org
index f32b0dd658..db0714e246 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -187,3 +187,8 @@
This version improves visual of multilined notes placed on the
window margins.
+
+- 2021-01-06 V1.1.3 Bastian Bechtold, cage ::
+
+ Optimized the code to speedup reading and saving of encrypted (with
+ GPG) annotated files.
diff --git a/annotate.el b/annotate.el
index db0fd1540f..94c5cf29ef 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: 1.1.2
+;; Version: 1.1.3
;; This file is NOT part of GNU Emacs.
@@ -58,7 +58,7 @@
;;;###autoload
(defgroup annotate nil
"Annotate files without changing them."
- :version "1.1.2"
+ :version "1.1.3"
:group 'text)
;;;###autoload
@@ -2212,8 +2212,31 @@ sophisticated way than plain text"
(and has-separator-p
has-info-p))
:info
- nil))))))
- (info-format-p)))
+ nil)))))
+ (gpg-format-p ()
+ (with-temp-buffer
+ (let* ((magic-0 #x8c)
+ (magic-1 #x0d)
+ (magic-4 #x03)
+ (magic-5 #x02)
+ (attributes (file-attributes filename))
+ (file-size (file-attribute-size
attributes)))
+ (when (> file-size 6)
+ (let* ((bytes
(insert-file-contents-literally filename
+
nil
+
0
+
7)))
+ (setf bytes
+ (cl-loop for i from 1 to 6 collect
+ (elt
(buffer-substring-no-properties i (1+ i))
+ 0)))
+ (when (and (= (logand (elt bytes 0)
#x0000ff) magic-0)
+ (= (logand (elt bytes 1)
#x0000ff) magic-1)
+ (= (logand (elt bytes 4)
#x0000ff) magic-4)
+ (= (logand (elt bytes 5)
#x0000ff) magic-5))
+ :encrypted-symmetric)))))))
+ (or (gpg-format-p)
+ (info-format-p)))) ;; keep this one for last as it is the slowest
;;;; summary window procedures
- [nongnu] elpa/annotate 286646bc0c 137/372: - made recongnizable code that refers to info file annotation. (2/3), (continued)
- [nongnu] elpa/annotate 286646bc0c 137/372: - made recongnizable code that refers to info file annotation. (2/3), ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 13391d9576 157/372: - expanded a comment and a docstring., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 0ae5752526 161/372: Merge pull request #54 from cage2/annotations-on-their-own-line, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate c21b95273e 177/372: Merge pull request #57 from cage2/master, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 2ccdad1504 193/372: - starting with a new method to render multiline annotations, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 71f316be2f 236/372: - added dependency on 'info'., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 7a96192be2 248/372: - according to documentation the secon argument of 'signal' must be a list., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate f2b085d279 288/372: - fixed typos., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 26ea8e3631 266/372: - prevented getting shared value for 'annotate-file' in '%load-annotation-data'., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate b505af0f27 300/372: - updated NEWS, Changelog and version number., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 17958167da 298/372: Merge pull request #96 from cage2/master,
ELPA Syncer <=
- [nongnu] elpa/annotate 784df37cba 313/372: - updated version number., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 9cdc2a90fb 350/372: - added prompt to confirm deletion also when deleting annotation's text;, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 3e0d5f39b2 302/372: Merge pull request #98 from cage2/master, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate cb8212830d 317/372: - added feature when the customizable variable, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate ff3a0089e0 330/372: Merge pull request #102 from cage2/prevent-prompt-annotating-newline, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 1a09f78be9 322/372: - added comments to local functions of 'annotate-annotate'., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 1e7bc9c886 364/372: - updated Changelog., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 5bc3415d56 353/372: - used 'yes-or-no-p' (customizable via a variable) to ask for deletion confirm., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate eaf96d584f 349/372: - added confirmation prompt before delete an annotation., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate e37820134f 332/372: - updated NEWS, Changelog and version number., ELPA Syncer, 2022/02/04