GNU bug report logs - #41274
[PATCH 9/9] * lisp/epa.el (epa-show-key): New command

Previous Next

Package: emacs;

Reported by: Jonas Bernoulli <jonas <at> bernoul.li>

Date: Thu, 14 May 2020 19:14:05 UTC

Severity: normal

Tags: patch

Merged with 41268, 41269, 41270, 41271, 41272, 41273, 41275, 41276, 41277

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41274 in the body.
You can then email your comments to 41274 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#41274; Package emacs. (Thu, 14 May 2020 19:14:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jonas Bernoulli <jonas <at> bernoul.li>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 14 May 2020 19:14:06 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jonas Bernoulli <jonas <at> bernoul.li>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH 9/9] * lisp/epa.el (epa-show-key): New command
Date: Thu, 14 May 2020 21:13:25 +0200
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
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 1e0a0132d2..fe5dd4321a 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)
 
 ;;; Options
@@ -192,6 +194,7 @@ epa-key-list-mode-map
   (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)
@@ -518,6 +521,14 @@ epa-select-keys
 
 ;;;; Key Details
 
+(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)
-- 
2.26.0





Forcibly Merged 41268 41269 41270 41271 41272 41273 41274 41276. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 14 May 2020 22:14:04 GMT) Full text and rfc822 format available.

Forcibly Merged 41268 41269 41270 41271 41272 41273 41274 41275 41276. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 14 May 2020 22:14:04 GMT) Full text and rfc822 format available.

Forcibly Merged 41268 41269 41270 41271 41272 41273 41274 41275 41276 41277. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 14 May 2020 22:14:05 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41274; Package emacs. (Tue, 23 Jun 2020 22:58:01 GMT) Full text and rfc822 format available.

Message #14 received at 41274 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Jonas Bernoulli <jonas <at> bernoul.li>
Cc: 41274 <at> debbugs.gnu.org
Subject: Re: bug#41274: [PATCH 9/9] * lisp/epa.el (epa-show-key): New command
Date: Tue, 23 Jun 2020 23:57:37 +0100
Jonas Bernoulli <jonas <at> bernoul.li> writes:

> diff --git a/lisp/epa.el b/lisp/epa.el
> index 1e0a0132d2..fe5dd4321a 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)
>  
>  ;;; Options
> @@ -518,6 +521,14 @@ epa-select-keys
>  
>  ;;;; Key Details
>  
> +(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")))

If you prefer, you can avoid loading subr-x via

  (let ((key (or (get-text-property ...)
                 (error ...))))
    ...)

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41274; Package emacs. (Tue, 07 Jul 2020 15:35:02 GMT) Full text and rfc822 format available.

Message #17 received at 41274 <at> debbugs.gnu.org (full text, mbox):

From: Jonas Bernoulli <jonas <at> bernoul.li>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 41274 <at> debbugs.gnu.org
Subject: Re: bug#41274: [PATCH 9/9] * lisp/epa.el (epa-show-key): New command
Date: Tue, 07 Jul 2020 17:34:32 +0200
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

> If you prefer, you can avoid loading subr-x via
>
>   (let ((key (or (get-text-property ...)
>                  (error ...))))
>     ...)

I do not prefer that, so I haven't done it.
Tell me if I *should* do it.




bug closed, send any further explanations to 41276 <at> debbugs.gnu.org and Jonas Bernoulli <jonas <at> bernoul.li> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 06 Aug 2020 07:27:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 03 Sep 2020 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 235 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.