* better UI for epa-insert-keys
@ 2019-12-25 2:34 Richard Stallman
2019-12-27 18:27 ` Lars Ingebrigtsen
0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2019-12-25 2:34 UTC (permalink / raw)
To: emacs-devel
[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)
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-28 1:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-25 2:34 better UI for epa-insert-keys Richard Stallman
2019-12-27 18:27 ` Lars Ingebrigtsen
2019-12-28 1:24 ` Richard Stallman
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).