From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: better UI for epa-insert-keys Date: Tue, 24 Dec 2019 21:34:56 -0500 Message-ID: Reply-To: rms@gnu.org Content-Type: text/plain; charset=Utf-8 Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="263449"; mail-complaints-to="usenet@blaine.gmane.org" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 25 03:35:39 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ijwWQ-0016NU-LQ for ged-emacs-devel@m.gmane.org; Wed, 25 Dec 2019 03:35:38 +0100 Original-Received: from localhost ([::1]:43338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ijwWO-0004tO-OL for ged-emacs-devel@m.gmane.org; Tue, 24 Dec 2019 21:35:36 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44326) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ijwVn-0004JP-LT for emacs-devel@gnu.org; Tue, 24 Dec 2019 21:35:00 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:53714) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ijwVn-0003BJ-H5 for emacs-devel@gnu.org; Tue, 24 Dec 2019 21:34:59 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1ijwVk-0003Tj-Dm; Tue, 24 Dec 2019 21:34:57 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:243623 Archived-At: [I have had no response to posting this a week ago] I've written a patch to make epa-list-keys insert text to explain the cryptic letters that come first in each line. This function epa--insert-keys is called from other places and I don't entirely understand how they are supposed to interact. I added comments explaining what I think that does but I am not sure of them. Would someone please verify this code and the comments? diff --git a/lisp/epa.el b/lisp/epa.el index a2be9a3..5ec33b7 100644 --- a/lisp/epa.el +++ b/lisp/epa.el @@ -360,7 +360,10 @@ epa--insert-keys 'start-open t 'end-open t))))) -(defun epa--list-keys (name secret) +(defun epa--list-keys (name secret &optional doc) + "NAME specifies which key to list. +SECRET says list data on the secret key (default, the public key). +DOC is documentation text to insert at the start." (unless (and epa-keys-buffer (buffer-live-p epa-keys-buffer)) (setq epa-keys-buffer (generate-new-buffer "*Keys*"))) @@ -370,13 +373,28 @@ epa--list-keys buffer-read-only (point (point-min)) (context (epg-make-context epa-protocol))) + + ;; Find the end of the documentation text at the start. + ;; Set POINT to where it ends, or nil if ends at eob. (unless (get-text-property point 'epa-list-keys) (setq point (next-single-property-change point 'epa-list-keys))) + + ;; If caller specified documentation text for that, replace the old + ;; documentation text (if any) with what was specified. + ;; Otherwise, preserve whatever intro text is present. + (when doc + (if (or point (not (eobp))) + (delete-region (point-min) point)) + (insert doc) + (setq point (point))) + + ;; Now delete the key description text, if any. (when point (delete-region point (or (next-single-property-change point 'epa-list-keys) (point-max))) (goto-char point)) + (epa--insert-keys (epg-list-keys context name secret)) (widget-setup) (set-keymap-parent (current-local-map) widget-keymap)) @@ -395,7 +413,13 @@ epa-list-keys (car epa-list-keys-arguments))))) (list (if (equal name "") nil name))) (list nil))) - (epa--list-keys name nil)) + (epa--list-keys name nil + "The letters at the start of a line have these meanings. +e expired key. n never trust. m trust marginally. u trust ultimately. +f trust fully (keys you have signed, usually). +q trust status questionable. - trust status unspecified. + See GPG documentaion for more explanation. +\n")) ;;;###autoload (defun epa-list-secret-keys (&optional name) -- Dr Richard Stallman Founder, Free Software Foundation (https://gnu.org, https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org)