[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/annotate e53c0f5adf 296/372: - added checking encrypted (G
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/annotate e53c0f5adf 296/372: - added checking encrypted (GPG) file format |
Date: |
Fri, 4 Feb 2022 16:59:09 -0500 (EST) |
branch: elpa/annotate
commit e53c0f5adff8e8c0c6ef3f3ddca5706f974ccf70
Author: cage <cage-invalid@invalid>
Commit: cage <cage-invalid@invalid>
- 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).
---
annotate.el | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/annotate.el b/annotate.el
index db0fd1540f..59ceadfd99 100644
--- a/annotate.el
+++ b/annotate.el
@@ -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 1143087515 213/372: - updated documentation., (continued)
- [nongnu] elpa/annotate 1143087515 213/372: - updated documentation., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate b8fd76f712 216/372: Merge pull request #60 from cage2/rethink-multiline-annotations, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate a37ec08035 249/372: - added signalling of error to 'annotate-switch-db';, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 34f0df8d5b 251/372: - updated documentation., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate bc89867f65 289/372: Merge pull request #92 from cage2/expand-db-path, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate be998ca006 263/372: Merge pull request #81 from cage2/popup-annotation, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 804c7b9421 257/372: - Removed internal link because of issue #79., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate a9f061cecd 268/372: - added more docstrings., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 88ed6f22cb 285/372: - rewritten export and integrate of annotations, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 463e215bec 284/372: - fixed export for annotated text made from a single line., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate e53c0f5adf 296/372: - added checking encrypted (GPG) file format,
ELPA Syncer <=
- [nongnu] elpa/annotate be48989c98 299/372: - fixed 'annotate-previous-annotation-ends', ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 59ca58c06b 308/372: changed function from 'font-lock-ensure' to 'font-lock-flush'., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate f823c3cf09 354/372: - changed default for asking confirm before deleting an annotation: the value is now 'nil' (do not prompt for confirmation)., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 3bb813cd62 360/372: - updated NEWS.org and Changelog., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 140eb6b6cb 363/372: - updated NEWS.org;, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate b22f594f3b 336/372: Merge pull request #107 from cage2/prevent-saving-empty-db, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate de86b9b22e 341/372: - removed uses of regular expressions from 'annotate-unwrap-text'., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate e083073ead 371/372: - updated Changelog;, ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate 0901aa52bc 367/372: - added the others procedures to import an annotation database., ELPA Syncer, 2022/02/04
- [nongnu] elpa/annotate f08923762f 063/372: fix typo in documentation, ELPA Syncer, 2022/02/04