emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9f82622 6/8: Cosmetic changes to epa libraries


From: Jonas Bernoulli
Subject: master 9f82622 6/8: Cosmetic changes to epa libraries
Date: Wed, 15 Jul 2020 12:12:30 -0400 (EDT)

branch: master
commit 9f82622d33b7e7558d1ba30781b209b599b24b52
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    Cosmetic changes to epa libraries
    
    These changes make the code more readable.
    
    * lisp/epa-dired.el (epa-dired-do-decrypt, epa-dired-do-verify)
    (epa-dired-do-sign, epa-dired-do-encrypt): Use dolist instead
    of while.
    * lisp/epa-file.el (epa-file-passphrase-callback-function):
    Set just one variable per setq call.
---
 lisp/epa-dired.el | 44 ++++++++++++++++++--------------------------
 lisp/epa-file.el  |  4 ++--
 2 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/lisp/epa-dired.el b/lisp/epa-dired.el
index f601d42..9269ea9 100644
--- a/lisp/epa-dired.el
+++ b/lisp/epa-dired.el
@@ -29,48 +29,40 @@
 (defun epa-dired-do-decrypt ()
   "Decrypt marked files."
   (interactive)
-  (let ((file-list (dired-get-marked-files)))
-    (while file-list
-      (epa-decrypt-file (expand-file-name (car file-list)))
-      (setq file-list (cdr file-list)))
-    (revert-buffer)))
+  (dolist (file (dired-get-marked-files))
+    (epa-decrypt-file (expand-file-name file)))
+  (revert-buffer))
 
 ;;;###autoload
 (defun epa-dired-do-verify ()
   "Verify marked files."
   (interactive)
-  (let ((file-list (dired-get-marked-files)))
-    (while file-list
-      (epa-verify-file (expand-file-name (car file-list)))
-      (setq file-list (cdr file-list)))))
+  (dolist (file (dired-get-marked-files))
+    (epa-verify-file (expand-file-name file))))
 
 ;;;###autoload
 (defun epa-dired-do-sign ()
   "Sign marked files."
   (interactive)
-  (let ((file-list (dired-get-marked-files)))
-    (while file-list
-      (epa-sign-file
-       (expand-file-name (car file-list))
-       (epa-select-keys (epg-make-context) "Select keys for signing.
+  (dolist (file (dired-get-marked-files))
+    (epa-sign-file
+     (expand-file-name file)
+     (epa-select-keys (epg-make-context) "Select keys for signing.
 If no one is selected, default secret key is used.  "
-                       nil t)
-       (y-or-n-p "Make a detached signature? "))
-      (setq file-list (cdr file-list)))
-    (revert-buffer)))
+                     nil t)
+     (y-or-n-p "Make a detached signature? ")))
+  (revert-buffer))
 
 ;;;###autoload
 (defun epa-dired-do-encrypt ()
   "Encrypt marked files."
   (interactive)
-  (let ((file-list (dired-get-marked-files)))
-    (while file-list
-      (epa-encrypt-file
-       (expand-file-name (car file-list))
-       (epa-select-keys (epg-make-context) "Select recipients for encryption.
-If no one is selected, symmetric encryption will be performed.  "))
-      (setq file-list (cdr file-list)))
-    (revert-buffer)))
+  (dolist (file (dired-get-marked-files))
+    (epa-encrypt-file
+     (expand-file-name file)
+     (epa-select-keys (epg-make-context) "Select recipients for encryption.
+If no one is selected, symmetric encryption will be performed.  ")))
+  (revert-buffer))
 
 (provide 'epa-dired)
 
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index 14a169b..20043a9 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -61,8 +61,8 @@ encryption is used."
          (or (copy-sequence (cdr entry))
              (progn
                (unless entry
-                 (setq entry (list file)
-                       epa-file-passphrase-alist
+                 (setq entry (list file))
+                 (setq epa-file-passphrase-alist
                        (cons entry
                              epa-file-passphrase-alist)))
                (setq passphrase (epa-passphrase-callback-function context



reply via email to

[Prev in Thread] Current Thread [Next in Thread]