From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Jonas Bernoulli Newsgroups: gmane.emacs.bugs Subject: bug#41276: [PATCH 7/9] Cosmetic changes to epa libraries Date: Thu, 14 May 2020 22:16:16 +0200 Message-ID: <20200514201618.26313-7-jonas@bernoul.li> References: <20200514201618.26313-1-jonas@bernoul.li> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="58316"; mail-complaints-to="usenet@ciao.gmane.io" To: 41276@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 14 22:22:44 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jZKNP-000F3r-Md for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 May 2020 22:22:43 +0200 Original-Received: from localhost ([::1]:46726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZKNO-0000Hj-IK for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 May 2020 16:22:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZKHy-0001aL-09 for bug-gnu-emacs@gnu.org; Thu, 14 May 2020 16:17:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51708) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZKHx-0003VD-M7 for bug-gnu-emacs@gnu.org; Thu, 14 May 2020 16:17:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jZKHx-0003RH-Hv for bug-gnu-emacs@gnu.org; Thu, 14 May 2020 16:17:05 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jonas Bernoulli Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 May 2020 20:17:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41276 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 41276-submit@debbugs.gnu.org id=B41276.158948738913098 (code B ref 41276); Thu, 14 May 2020 20:17:05 +0000 Original-Received: (at 41276) by debbugs.gnu.org; 14 May 2020 20:16:29 +0000 Original-Received: from localhost ([127.0.0.1]:35009 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZKHN-0003P6-9J for submit@debbugs.gnu.org; Thu, 14 May 2020 16:16:29 -0400 Original-Received: from mail.hostpark.net ([212.243.197.30]:60584) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZKHF-0003NS-5w for 41276@debbugs.gnu.org; Thu, 14 May 2020 16:16:21 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 475D5166B6 for <41276@debbugs.gnu.org>; Thu, 14 May 2020 22:16:20 +0200 (CEST) X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Original-Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10124) with ESMTP id cf0ioTdLAcfT for <41276@debbugs.gnu.org>; Thu, 14 May 2020 22:16:19 +0200 (CEST) Original-Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 67067166BD for <41276@debbugs.gnu.org>; Thu, 14 May 2020 22:16:19 +0200 (CEST) X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200514201618.26313-1-jonas@bernoul.li> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:180274 Archived-At: * 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 1bcfb758ed..4ff1ba3394 100644 --- a/lisp/epa-dired.el +++ b/lisp/epa-dired.el @@ -30,48 +30,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 3e23c09a51..de51c59c34 100644 --- a/lisp/epa-file.el +++ b/lisp/epa-file.el @@ -66,8 +66,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