all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jonas Bernoulli <jonas@bernoul.li>
To: 41276@debbugs.gnu.org
Subject: bug#41276: [PATCH v2 6/8] Cosmetic changes to epa libraries
Date: Tue,  7 Jul 2020 17:47:37 +0200	[thread overview]
Message-ID: <20200707154739.1829-7-jonas@bernoul.li> (raw)
In-Reply-To: <20200707154739.1829-6-jonas@bernoul.li>

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 f601d42656..9269ea9707 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 14a169b13f..20043a9eae 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -61,8 +61,8 @@ epa-file-passphrase-callback-function
 	  (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
-- 
2.26.0






  reply	other threads:[~2020-07-07 15:47 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14 19:13 bug#41276: [PATCH 0/9] Various small improvements to EasyPG Jonas Bernoulli
2020-05-14 19:13 ` bug#41272: [PATCH 1/9] * lisp/epa.el (epa-faces): Move definition Jonas Bernoulli
2020-05-14 19:13 ` bug#41269: [PATCH 2/9] Add all epa faces to epa-faces Custom group Jonas Bernoulli
2020-05-14 19:13 ` bug#41270: [PATCH 3/9] * lisp/epg-config.el (epg-config--make-gpg-configuration): Fix indentation Jonas Bernoulli
2020-05-14 19:13 ` bug#41275: [PATCH 4/9] Split EasyPG libraries into outline sections Jonas Bernoulli
2020-05-14 19:13 ` bug#41277: [PATCH 5/9] Improve and add doc-strings Jonas Bernoulli
2020-05-14 19:13 ` bug#41268: [PATCH 6/9] Drop unnecessary backward compatibility aliases Jonas Bernoulli
2020-05-14 19:13 ` bug#41271: [PATCH 7/9] Cosmetic changes to epa libraries Jonas Bernoulli
2020-05-14 19:13 ` bug#41273: [PATCH 8/9] epa-key-list-mode-map: Use widget-keymap as parent keymap Jonas Bernoulli
2020-05-14 19:13 ` bug#41274: [PATCH 9/9] * lisp/epa.el (epa-show-key): New command Jonas Bernoulli
2020-06-23 22:57   ` Basil L. Contovounesios
2020-07-07 15:34     ` Jonas Bernoulli
     [not found] ` <handler.41276.B.15894836275636.ack@debbugs.gnu.org>
2020-05-14 20:14   ` bug#41276: Acknowledgement ([PATCH 0/9] Various small improvements to EasyPG) Jonas Bernoulli
2020-05-14 22:33     ` Stefan Kangas
2020-05-15  7:26     ` Eli Zaretskii
2020-05-15 11:27       ` Jonas Bernoulli
2020-05-15 11:52         ` Eli Zaretskii
2020-05-15 16:56           ` Jonas Bernoulli
2020-05-15 17:42             ` Eli Zaretskii
2020-05-15 22:42               ` Jonas Bernoulli
2020-05-16  6:45                 ` Eli Zaretskii
2020-05-14 20:16 ` bug#41276: [PATCH 1/9] * lisp/epa.el (epa-faces): Move definition Jonas Bernoulli
2020-05-14 20:16   ` bug#41276: [PATCH 2/9] Add all epa faces to epa-faces Custom group Jonas Bernoulli
2020-05-15  9:32     ` Robert Pluim
2020-06-23 22:57       ` Basil L. Contovounesios
2020-07-07 15:32         ` Jonas Bernoulli
2020-05-14 20:16   ` bug#41276: [PATCH 3/9] * lisp/epg-config.el (epg-config--make-gpg-configuration): Fix indentation Jonas Bernoulli
2020-05-14 20:16   ` bug#41276: [PATCH 4/9] Split EasyPG libraries into outline sections Jonas Bernoulli
2020-05-14 20:16   ` bug#41276: [PATCH 5/9] Improve and add doc-strings Jonas Bernoulli
2020-05-14 20:16   ` bug#41276: [PATCH 6/9] Drop unnecessary backward compatibility aliases Jonas Bernoulli
2020-05-14 20:16   ` bug#41276: [PATCH 7/9] Cosmetic changes to epa libraries Jonas Bernoulli
2020-05-14 20:16   ` bug#41276: [PATCH 8/9] epa-key-list-mode-map: Use widget-keymap as parent keymap Jonas Bernoulli
2020-05-15  7:27     ` Eli Zaretskii
2020-05-14 20:16   ` bug#41276: [PATCH 9/9] * lisp/epa.el (epa-show-key): New command Jonas Bernoulli
2020-05-14 23:04 ` bug#41276: [PATCH 0/9] Various small improvements to EasyPG Stefan Kangas
2020-05-15  9:26   ` Robert Pluim
2020-05-25  1:34     ` Noam Postavsky
2020-07-17  7:30       ` Robert Pluim
2020-07-07 15:47 ` bug#41276: [PATCH v2 0/8] " Jonas Bernoulli
2020-07-07 15:47   ` bug#41276: [PATCH v2 1/8] * lisp/epa.el (epa-faces): Move definition Jonas Bernoulli
2020-07-07 15:47     ` bug#41276: [PATCH v2 2/8] Add all epa faces to epa-faces Custom group Jonas Bernoulli
2020-07-07 15:47       ` bug#41276: [PATCH v2 3/8] * lisp/epg-config.el (epg-config--make-gpg-configuration): Fix indentation Jonas Bernoulli
2020-07-07 15:47         ` bug#41276: [PATCH v2 4/8] Improve and add doc-strings Jonas Bernoulli
2020-07-07 15:47           ` bug#41276: [PATCH v2 5/8] Drop unnecessary backward compatibility aliases Jonas Bernoulli
2020-07-07 15:47             ` Jonas Bernoulli [this message]
2020-07-07 15:47               ` bug#41276: [PATCH v2 7/8] epa-key-list-mode-map: Use widget-keymap as parent keymap Jonas Bernoulli
2020-07-07 15:47                 ` bug#41276: [PATCH v2 8/8] * lisp/epa.el (epa-show-key): New command Jonas Bernoulli
2020-07-07 18:30   ` bug#41276: [PATCH v2 0/8] Various small improvements to EasyPG Eli Zaretskii
2020-07-07 21:09     ` Jonas Bernoulli
2020-07-08  2:29       ` Eli Zaretskii
2020-07-08 12:08         ` Jonas Bernoulli
2020-07-14 18:09           ` Jonas Bernoulli
2020-07-14 18:16             ` Eli Zaretskii
2020-07-14 18:27               ` Jonas Bernoulli
2020-07-14 18:57                 ` Eli Zaretskii
2020-07-14 20:20                   ` Jonas Bernoulli
2020-07-15  2:22                     ` Eli Zaretskii
2020-08-05 19:03 ` bug#41276: [PATCH 0/9] " Lars Ingebrigtsen
2020-08-06  7:22   ` bug#41268: " Jonas Bernoulli
2020-08-06  7:26     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200707154739.1829-7-jonas@bernoul.li \
    --to=jonas@bernoul.li \
    --cc=41276@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.