[Top][All Lists]

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

Re: problems importing keys via epa-search-keys

From: Filipp Gunbin
Subject: Re: problems importing keys via epa-search-keys
Date: Sun, 12 Mar 2023 02:04:21 +0300
User-agent: Gnus/5.13 (Gnus v5.13)

On 11/03/2023 09:17 +0200, Eli Zaretskii wrote:

>> From: Filipp Gunbin <>
>> Cc:, Philip Kaludercic <>, Eli
>>  Zaretskii <>
>> Date: Sat, 11 Mar 2023 01:58:43 +0300
>> Yes, broken since 23b6cd41f55b833e8a562c51642d36b5211a510b, the patch is
>> below.
>> Eli, would this be OK for emacs-29?  This is clearly a regression.
> It's a regression that existed since Emacs 28.1, right?  So its fix
> should try to avoid changing APIs.  Therefore, please try to make a
> change that leaves the signature of epa-ks--query-url unchanged, I
> think it should be easy in this case.  (Yes, I know it's an internal
> function, but that doesn't mean we can change the signature when we
> can avoid that.)

Yes, since 28.1.  The updated patch is below.

But why an internal function is part of API?  Don't we assume that
anyone using them is doing so at their own risk?  In this case the
default for operation is "index" (to preserve compatibility), but it's
better here to not have the default value at all.

> P.S. And why are you posting patches and their discussion here, not on
> the bug tracker?

Because OP wrote here?  And we didn't open a bug for this.  Should we,
even for such simple fixes?


diff --git a/lisp/epa-ks.el b/lisp/epa-ks.el
index 77d896fa438..015bf910ac6 100644
--- a/lisp/epa-ks.el
+++ b/lisp/epa-ks.el
@@ -140,8 +140,8 @@ epa-ks-do-key-to-fetch
           (epa-ks--fetch-key id)))))
-(defun epa-ks--query-url (query exact)
-  "Return URL for QUERY.
+(defun epa-ks--query-url (query exact &optional operation)
+  "Return URL for QUERY and OPERATION (defaults to \"index\").
 If EXACT is non-nil, don't accept approximate matches."
   (format "https://%s/pks/lookup?%s";
           (cond ((null epa-keyserver)
@@ -154,13 +154,13 @@ epa-ks--query-url
            (append `(("search" ,query)
                      ("options" "mr")
-                     ("op" "index"))
+                     ("op" ,(or operation "index")))
                    (and exact '(("exact" "on")))))))
 (defun epa-ks--fetch-key (id)
   "Send request to import key with specified ID."
-   (epa-ks--query-url (concat "0x" (url-hexify-string id)) t)
+   (epa-ks--query-url (concat "0x" (url-hexify-string id)) t "get")
    (lambda (status)
      (when (plist-get status :error)
        (error "Request failed: %s"
@@ -236,7 +236,7 @@ epa-search-keys
-     (epa-ks--query-url query exact)
+     (epa-ks--query-url query exact "index")
      (lambda (status)
        (when (plist-get status :error)
          (when buf

reply via email to

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