From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#69133: [PATCH] Make key selection method configurable in EPA. Date: Thu, 15 Feb 2024 08:07:17 +0200 Message-ID: <8634tuxnu2.fsf@gnu.org> References: <875xyqbzgj.fsf@disroot.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14604"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69133@debbugs.gnu.org To: Aleksandr Vityazev Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 15 07:08:11 2024 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 1raUup-0003c5-JZ for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Feb 2024 07:08:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raUuO-0006kK-Fr; Thu, 15 Feb 2024 01:07:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raUuN-0006k7-RT for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 01:07:43 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1raUuN-0001jx-J3 for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 01:07:43 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1raUuf-00028H-Mx for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 01:08:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Feb 2024 06:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69133 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 69133-submit@debbugs.gnu.org id=B69133.17079772688178 (code B ref 69133); Thu, 15 Feb 2024 06:08:01 +0000 Original-Received: (at 69133) by debbugs.gnu.org; 15 Feb 2024 06:07:48 +0000 Original-Received: from localhost ([127.0.0.1]:53737 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raUuR-00027q-Tv for submit@debbugs.gnu.org; Thu, 15 Feb 2024 01:07:48 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raUuP-00027c-9e for 69133@debbugs.gnu.org; Thu, 15 Feb 2024 01:07:46 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raUu1-0001dR-1F; Thu, 15 Feb 2024 01:07:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=XJ7ieIiNH9Cdh1CW3n82mKivG+Q8Dz1//Rp1qLUysh0=; b=Y8NvWiuUR2SiTF+AdHu0 zvjxZfSP77HfDGUse0KYhSEQGS8RYHFUG7mhh0n7nZmbD3OZySlwTm2hGBFd/b6oHG68h+KmaaUof M/g/brpL1vOidhySzIGmhW945yj1s/QK+J6J1lP92PNWXC/bih0t6pVB6dxUsh7TU+VJB40OlL3+u 0An3WHx3182eo8VQ5B+tzyq7ZLxkKHtBcZ7JtIuzdGQSJlB8sgEcgl4u+8d3gQVGCXR0qzNRrYrg1 NOSbENm5dub31MbiecWMYuWi6bhMrP+4d9lb+wn1F64DatI78NPoG5Smucd4iAeQvuL2p7kZ5gxXT 7Vngea8KdKLfKA==; In-Reply-To: <875xyqbzgj.fsf@disroot.org> (bug-gnu-emacs@gnu.org) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280038 Archived-At: > Date: Wed, 14 Feb 2024 22:47:08 +0300 > From: Aleksandr Vityazev via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > Currently in epa.el it is possible to select keys only through a > separate buffer, I think adding the option to select via minibuffer > would be a nice addition. The current behavior is set to default. Any > comments? Thanks, some comments below, > --- a/etc/NEWS > +++ b/etc/NEWS > @@ -1352,6 +1352,14 @@ characters, such as ½ (U+00BD VULGAR FRACTION ONE HALF), are also > recognized as rational fractions. They have been since 2004, but it > looks like it was never mentioned in the NEWS, or even the manual. > > +** EasyPG > + > +--- > +*** New user option 'epa-keys-select-method' Heading lines in NEWS should end with a period. > +This allows the user to customize the key selection method, a minibuffer > +or buffer option is available, which is set by default and was used in > +all earlier versions. This sentence is too complex. Suggest to reword as two sentences: This allows the user to customize the key selection method, which can be either by using a pop-up buffer or from the minibuffer. The pop-up buffer method is the default, which preserves previous behavior. Also, why did you decide not to document this in the manual? epa.el has its own manual, so how about adding this option to it? > +(defcustom epa-keys-select-method 'buffer > + "Method used to select keys. > +It can have two values: buffer or minibuffer. > +Can have two values: buffer or minibuffer. In the first case, the keys > +can be selected via a pop-up buffer. In the second case, the keys > +can be selected via a minibuffer and `completing-read-multiple' will be > +used." The doc string could also be simplified. Like this, for example: Method used to select keys in `epa-select-keys'. If the value is \\='buffer, the default, keys are selected via a pop-up buffer. If the value is \\='minibuffer, keys are selected via the minibuffer instead, using `completing-read-multiple'. This avoids explaining the values twice (first what they are, then what they do), and also mentions the default value. Please also make sure comments, doc strings, and commit log messages leave two spaces between sentences, per our conventions. You had a couple of problems with that in the patch, which my suggested rephrasing fixed, but please keep this in mind in the future. > + :type '(choice (const :tag "Read keys from buffer" buffer) ^^^^^^^^^^^^^^^^^^^^^ This should probably say "...from a pop-up buffer". > (defun epa-select-keys (context prompt &optional names secret) > "Display a user's keyring and ask him to select keys. > @@ -459,7 +484,10 @@ epa-select-keys > the keys are listed. > If SECRET is non-nil, list secret keys instead of public keys." > (let ((keys (epg-list-keys context names secret))) > - (epa--select-keys prompt keys))) > + (pcase epa-keys-select-method > + ('buffer (epa--select-keys prompt keys)) > + ('minibuffer (epa--select-keys-in-minibuffer prompt keys)) > + (_ (error "Wrong method for key selection is specified"))))) Hmm... are you assuming users know how to input multiple strings from the minibuffer, in particular what is the value of crm-separator? the function epa--select-keys inserts some instructions into the pop-up buffer, but this new function you propose just shows the prompt and nothing else. Should it somehow help the user with the job of typing the keys at the prompt? Also, maybe instead of signaling an error for a value that's neither 'buffer' nor 'minibuffer', we should treat such values as 'buffer'?