From c2ef4a13c0cfb44a950fc32e3103952bb8e52772 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Tue, 18 Feb 2020 16:45:34 +0100 Subject: * lisp/epa.el (epa-faces): Move definition. Previously option `epa-mail-aliases' was the only option that was defined right after the group `epa-faces' and right before all the faces. Now it is defined with all the other options and thus before the definition of the `epa-faces' group, which it does not belong to. --- lisp/epa.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lisp/epa.el') diff --git a/lisp/epa.el b/lisp/epa.el index 8ec42187358..0dd1cff4652 100644 --- a/lisp/epa.el +++ b/lisp/epa.el @@ -56,11 +56,6 @@ If neither t nor nil, ask user for confirmation." :type 'integer :group 'epa) -(defgroup epa-faces nil - "Faces for epa-mode." - :version "23.1" - :group 'epa) - (defcustom epa-mail-aliases nil "Alist of aliases of email addresses that stand for encryption keys. Each element is a list of email addresses (ALIAS EXPANSIONS...). @@ -76,6 +71,11 @@ The command `epa-mail-encrypt' uses this." :group 'epa :version "24.4") +(defgroup epa-faces nil + "Faces for epa-mode." + :version "23.1" + :group 'epa) + (defface epa-validity-high '((default :weight bold) (((class color) (background dark)) :foreground "PaleTurquoise")) -- cgit v1.2.3 From bb6fe683a29e832886292bf89ebb2c1f861f355b Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Tue, 18 Feb 2020 16:49:19 +0100 Subject: Add all epa faces to epa-faces Custom group `epa-validity-face-alist' isn't actually a face but belongs in that group anyway. * lisp/epa.el (epa-field-name, epa-field-body) (epa-validity-face-alist): Add to epa-faces Custom group. --- lisp/epa.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lisp/epa.el') diff --git a/lisp/epa.el b/lisp/epa.el index 0dd1cff4652..40b3861ea87 100644 --- a/lisp/epa.el +++ b/lisp/epa.el @@ -117,13 +117,15 @@ The command `epa-mail-encrypt' uses this." '((default :weight bold) (((class color) (background dark)) :foreground "PaleTurquoise")) "Face for the name of the attribute field." - :group 'epa) + :version "28.1" + :group 'epa-faces) (defface epa-field-body '((default :slant italic) (((class color) (background dark)) :foreground "turquoise")) "Face for the body of the attribute field." - :group 'epa) + :version "28.1" + :group 'epa-faces) (defcustom epa-validity-face-alist '((unknown . epa-validity-disabled) @@ -138,8 +140,9 @@ The command `epa-mail-encrypt' uses this." (full . epa-validity-high) (ultimate . epa-validity-high)) "An alist mapping validity values to faces." + :version "28.1" :type '(repeat (cons symbol face)) - :group 'epa) + :group 'epa-faces) (defvar epa-font-lock-keywords '(("^\\*" -- cgit v1.2.3 From 0e2af5cc3726d6e661f0f396a843185326ed5e7d Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Tue, 18 Feb 2020 16:59:00 +0100 Subject: Improve and add doc-strings * lisp/epa-file.el (epa-file-select-keys): lisp/epa-hook.el (epa-file-name-regexp): lisp/epa.el (epa-exit-buffer): Improve doc-string. * lisp/epa-hook.el (epa-file-name-regexp-update): Add doc-string. --- lisp/epa-file.el | 4 ++-- lisp/epa-hook.el | 11 +++++++---- lisp/epa.el | 3 +-- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'lisp/epa.el') diff --git a/lisp/epa-file.el b/lisp/epa-file.el index dedf20b0d77..22c3dc1146b 100644 --- a/lisp/epa-file.el +++ b/lisp/epa-file.el @@ -40,9 +40,9 @@ Note that this option has no effect if you use GnuPG 2.0." (defcustom epa-file-select-keys nil "Control whether or not to pop up the key selection dialog. -If t, always asks user to select recipients. +If t, always ask user to select recipients. If nil, query user only when `epa-file-encrypt-to' is not set. -If neither t nor nil, doesn't ask user. In this case, symmetric +If neither t nor nil, don't ask user. In this case, symmetric encryption is used." :type '(choice (const :tag "Ask always" t) (const :tag "Ask when recipients are not set" nil) diff --git a/lisp/epa-hook.el b/lisp/epa-hook.el index d424e7a9faf..a86f23eb688 100644 --- a/lisp/epa-hook.el +++ b/lisp/epa-hook.el @@ -35,10 +35,10 @@ (defcustom epa-file-name-regexp (purecopy "\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'") "Regexp which matches filenames to be encrypted with GnuPG. -If you set this outside Custom while epa-file is already enabled, you -have to call `epa-file-name-regexp-update' after setting it to -properly update file-name-handler-alist. Setting this through Custom -does that automatically." +If you set this outside Custom while epa-file is already enabled, +you have to call `epa-file-name-regexp-update' after setting it +to properly update `file-name-handler-alist'. Setting this +through Custom does that automatically." :type 'regexp :group 'epa-file :set 'epa-file--file-name-regexp-set) @@ -72,6 +72,9 @@ May either be a string or a list of strings.") (list epa-file-name-regexp nil 'epa-file)) (defun epa-file-name-regexp-update () + "Update `file-name-handler-alist' after configuring outside Custom. +After setting `epa-file-name-regexp-update' outside the Custom +interface, update `file-name-handler-alist'." (interactive) (unless (equal (car epa-file-handler) epa-file-name-regexp) (setcar epa-file-handler epa-file-name-regexp))) diff --git a/lisp/epa.el b/lisp/epa.el index 40b3861ea87..e4d1e5b4148 100644 --- a/lisp/epa.el +++ b/lisp/epa.el @@ -335,8 +335,7 @@ If ARG is non-nil, mark the key." (epa-mark-key (not arg))) (defun epa-exit-buffer () - "Exit the current buffer. -`epa-exit-buffer-function' is called if it is set." + "Exit the current buffer using `epa-exit-buffer-function'." (interactive) (funcall epa-exit-buffer-function)) -- cgit v1.2.3 From 8c60347780937f87f8b5ff78e3e9372821cad89a Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Mon, 20 Apr 2020 23:33:44 +0200 Subject: epa-key-list-mode-map: Use widget-keymap as parent keymap Normally when one keymap is to be treated as the parent of another, then that relationship is setup once at the time when the child is being defined, i.e. at birth. For some reason, this was not done here; instead `widget-keymap' is set as `epa-key-list-mode-map' parent every time the former is setup to be used as the local map. This appears to be a mistake. A few other keymaps use `widget-keymap' as their parent and in those cases the relationship is established just once. `epa-key-list-mode-map' is the only exception and because there is absolutely no indication that that is justified, we remove this inconsistency. * lisp/epa.el (epa-key-list-mode-map): Set the parent of this keymap while defining it. * lisp/epa.el (epa--list-keys): Do not set the parent of the local keymap here. --- lisp/epa.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp/epa.el') diff --git a/lisp/epa.el b/lisp/epa.el index e4d1e5b4148..8f45c667b9a 100644 --- a/lisp/epa.el +++ b/lisp/epa.el @@ -188,6 +188,7 @@ You should bind this variable with `let', but do not set it globally.") (defvar epa-key-list-mode-map (let ((keymap (make-sparse-keymap)) (menu-map (make-sparse-keymap))) + (set-keymap-parent keymap widget-keymap) (define-key keymap "m" 'epa-mark-key) (define-key keymap "u" 'epa-unmark-key) (define-key keymap "d" 'epa-decrypt-file) @@ -399,8 +400,7 @@ DOC is documentation text to insert at the start." (goto-char point)) (epa--insert-keys (epg-list-keys context name secret)) - (widget-setup) - (set-keymap-parent (current-local-map) widget-keymap)) + (widget-setup)) (make-local-variable 'epa-list-keys-arguments) (setq epa-list-keys-arguments (list name secret)) (goto-char (point-min)) -- cgit v1.2.3 From 58bec884d5a911690c2f8e0ecca6a487bd2c9fe0 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Mon, 20 Apr 2020 23:31:16 +0200 Subject: * 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(-) (limited to 'lisp/epa.el') diff --git a/lisp/epa.el b/lisp/epa.el index 8f45c667b9a..3c7dd8309a8 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) -- cgit v1.2.3