emacs-diffs
[Top][All Lists]
Advanced

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

master 58bec88 8/8: * lisp/epa.el (epa-show-key): New command.


From: Jonas Bernoulli
Subject: master 58bec88 8/8: * lisp/epa.el (epa-show-key): New command.
Date: Wed, 15 Jul 2020 12:12:30 -0400 (EDT)

branch: master
commit 58bec884d5a911690c2f8e0ecca6a487bd2c9fe0
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    * lisp/epa.el (epa-show-key): New command.
    
    Users can move in `epa-key-list-mode' buffers using either
    `next-line'/`previous-line' or `widget-forward'/`widget-backward'.
    When using the first set of commands, then the cursor stays in the
    current column and that normally is the first column.  The key
    widgets do not begin until the third character of their respective
    lines.
    
    All `epa' commands work regardless of whether the cursor is on the
    widget or before them.  The `epa-show-key' command did not exist until
    now because the `widget-button-press' already performs its task.  But
    because the widgets don't span complete lines we actually need this
    command too.
---
 lisp/epa.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lisp/epa.el b/lisp/epa.el
index 8f45c66..3c7dd83 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -25,7 +25,9 @@
 (require 'epg)
 (require 'font-lock)
 (require 'widget)
-(eval-when-compile (require 'wid-edit))
+(eval-when-compile
+  (require 'subr-x)
+  (require 'wid-edit))
 (require 'derived)
 
 (defgroup epa nil
@@ -189,6 +191,7 @@ You should bind this variable with `let', but do not set it 
globally.")
   (let ((keymap (make-sparse-keymap))
        (menu-map (make-sparse-keymap)))
     (set-keymap-parent keymap widget-keymap)
+    (define-key keymap "\C-m" 'epa-show-key)
     (define-key keymap "m" 'epa-mark-key)
     (define-key keymap "u" 'epa-unmark-key)
     (define-key keymap "d" 'epa-decrypt-file)
@@ -502,6 +505,14 @@ 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)))
 
+(defun epa-show-key ()
+  "Show a key on the current line."
+  (interactive)
+  (if-let ((key (get-text-property (point) 'epa-key)))
+      (save-selected-window
+        (epa--show-key key))
+    (error "No key on this line")))
+
 (defun epa--show-key (key)
   (let* ((primary-sub-key (car (epg-key-sub-key-list key)))
         (entry (assoc (epg-sub-key-id primary-sub-key)



reply via email to

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