Merge remote-tracking branch 'savahnna/master' into HEAD

This commit is contained in:
Andrea Corallo 2020-07-15 23:13:59 +02:00
commit 907618b3b5
10 changed files with 89 additions and 91 deletions

View file

@ -202,7 +202,7 @@ terminal, the code(s) sent to the terminal.
@item @item
If the character was composed on display with any following characters If the character was composed on display with any following characters
to form one or more grapheme clusters, the composition information: to form one or more grapheme clusters, the composition information:
the font glyphs if the frame is on a graphical display, else the the font glyphs if the frame is on a graphical display, and the
characters that were composed. characters that were composed.
@item @item

View file

@ -469,7 +469,7 @@ variable @code{imenu-generic-expression}, for the two variables
@code{imenu-create-index-function} (@pxref{Imenu}). @code{imenu-create-index-function} (@pxref{Imenu}).
@item @item
The mode can tell Eldoc mode how to retrieve different types of The mode can tell ElDoc mode how to retrieve different types of
documentation for whatever is at point, by adding one or more documentation for whatever is at point, by adding one or more
buffer-local entries to the special hook buffer-local entries to the special hook
@code{eldoc-documentation-functions}. @code{eldoc-documentation-functions}.

View file

@ -263,7 +263,7 @@ obsolete.
*** 'eldoc-echo-area-use-multiline-p' is now handled by ElDoc. *** 'eldoc-echo-area-use-multiline-p' is now handled by ElDoc.
The user option 'eldoc-echo-area-use-multiline-p' is now handled The user option 'eldoc-echo-area-use-multiline-p' is now handled
by the Eldoc library itself. Functions in by the ElDoc library itself. Functions in
'eldoc-documentation-functions' don't need to worry about consulting 'eldoc-documentation-functions' don't need to worry about consulting
it when producing a doc string. it when producing a doc string.

View file

@ -775,13 +775,16 @@ The character information includes:
(setq glyph (lgstring-glyph gstring from))) (setq glyph (lgstring-glyph gstring from)))
(insert (format " %S\n" glyph)) (insert (format " %S\n" glyph))
(setq from (1+ from))) (setq from (1+ from)))
(insert "from these character(s):\n") (when (and (stringp (car composition))
(dotimes (i (lgstring-char-len gstring)) (string-match "\"\\([^\"]+\\)\"" (car composition)))
(let ((char (lgstring-char gstring i))) (insert "with these character(s):\n")
(insert (format " %c (#x%x) %s\n" (let ((chars (match-string 1 (car composition))))
char char (dotimes (i (length chars))
(get-char-code-property (let ((char (aref chars i)))
char 'name)))))) (insert (format " %c (#x%x) %s\n"
char char
(get-char-code-property
char 'name))))))))
;; TTY frame: show composition in terms of characters. ;; TTY frame: show composition in terms of characters.
(insert " by these characters:\n") (insert " by these characters:\n")
(while (and (<= from to) (while (and (<= from to)
@ -950,7 +953,7 @@ This function can be used as a value of
;; instead of returning a string tailored here for the echo area ;; instead of returning a string tailored here for the echo area
;; exclusively, we could call the (now unused) argument ;; exclusively, we could call the (now unused) argument
;; _CALLBACK with hints on how to shorten the string if needed, ;; _CALLBACK with hints on how to shorten the string if needed,
;; or with multiple usable strings which Eldoc picks according ;; or with multiple usable strings which ElDoc picks according
;; to its space contraints. ;; to its space contraints.
(describe-char-eldoc--format (describe-char-eldoc--format
ch ch

View file

@ -92,7 +92,7 @@ echo area must be resized to fit.
If value is a number (integer or floating point), it has the If value is a number (integer or floating point), it has the
semantics of `max-mini-window-height', constraining the resizing semantics of `max-mini-window-height', constraining the resizing
for Eldoc purposes only. for ElDoc purposes only.
Any resizing respects `max-mini-window-height'. Any resizing respects `max-mini-window-height'.
@ -112,9 +112,9 @@ single line of display in the echo area."
line" truncate-sym-name-if-fit))) line" truncate-sym-name-if-fit)))
(defcustom eldoc-prefer-doc-buffer nil (defcustom eldoc-prefer-doc-buffer nil
"Prefer Eldoc's documentation buffer if it is showing in some frame. "Prefer ElDoc's documentation buffer if it is showing in some frame.
If this variable's value is t and a piece of documentation needs If this variable's value is t and a piece of documentation needs
to be truncated to fit in the echo area, do so if Eldoc's to be truncated to fit in the echo area, do so if ElDoc's
documentation buffer is not already showing, since the buffer documentation buffer is not already showing, since the buffer
always holds the full documentation." always holds the full documentation."
:type 'boolean) :type 'boolean)
@ -495,8 +495,9 @@ Honor most of `eldoc-echo-area-use-multiline-p'."
(substitute-command-keys "\\[eldoc-doc-buffer]"))))))))) (substitute-command-keys "\\[eldoc-doc-buffer]")))))))))
((= available 1) ((= available 1)
;; Truncate "brutally." ; FIXME: use `eldoc-prefer-doc-buffer' too? ;; Truncate "brutally." ; FIXME: use `eldoc-prefer-doc-buffer' too?
(truncate-string-to-width (with-current-buffer (eldoc-doc-buffer)
(buffer-substring (point-min) (line-end-position 1)) width))))) (truncate-string-to-width
(buffer-substring (point-min) (line-end-position 1)) width))))))
(when echo-area-message (when echo-area-message
(eldoc--message echo-area-message)))))) (eldoc--message echo-area-message))))))
@ -539,11 +540,11 @@ Meant as a value for `eldoc-documentation-strategy'."
(if (stringp str) (funcall callback str)) (if (stringp str) (funcall callback str))
nil)))) nil))))
;; JT@2020-07-10: Eldoc is pre-loaded, so in in Emacs < 28 we can't ;; JT@2020-07-10: ElDoc is pre-loaded, so in Emacs < 28 we can't
;; make the "old" `eldoc-documentation-function' point to the new ;; make the "old" `eldoc-documentation-function' point to the new
;; `eldoc-documentation-strategy', so we do the reverse. This allows ;; `eldoc-documentation-strategy', so we do the reverse. This allows
;; for Eldoc to be loaded in those older Emacs versions and work with ;; for ElDoc to be loaded in those older Emacs versions and work with
;; whomever (major-modes, extensions, ueser) sets one of the other ;; whomever (major-modes, extensions, user) sets one or the other
;; variable. ;; variable.
(defmacro eldoc--documentation-strategy-defcustom (defmacro eldoc--documentation-strategy-defcustom
(main secondary value docstring &rest more) (main secondary value docstring &rest more)

View file

@ -29,48 +29,40 @@
(defun epa-dired-do-decrypt () (defun epa-dired-do-decrypt ()
"Decrypt marked files." "Decrypt marked files."
(interactive) (interactive)
(let ((file-list (dired-get-marked-files))) (dolist (file (dired-get-marked-files))
(while file-list (epa-decrypt-file (expand-file-name file)))
(epa-decrypt-file (expand-file-name (car file-list))) (revert-buffer))
(setq file-list (cdr file-list)))
(revert-buffer)))
;;;###autoload ;;;###autoload
(defun epa-dired-do-verify () (defun epa-dired-do-verify ()
"Verify marked files." "Verify marked files."
(interactive) (interactive)
(let ((file-list (dired-get-marked-files))) (dolist (file (dired-get-marked-files))
(while file-list (epa-verify-file (expand-file-name file))))
(epa-verify-file (expand-file-name (car file-list)))
(setq file-list (cdr file-list)))))
;;;###autoload ;;;###autoload
(defun epa-dired-do-sign () (defun epa-dired-do-sign ()
"Sign marked files." "Sign marked files."
(interactive) (interactive)
(let ((file-list (dired-get-marked-files))) (dolist (file (dired-get-marked-files))
(while file-list (epa-sign-file
(epa-sign-file (expand-file-name file)
(expand-file-name (car file-list)) (epa-select-keys (epg-make-context) "Select keys for signing.
(epa-select-keys (epg-make-context) "Select keys for signing.
If no one is selected, default secret key is used. " If no one is selected, default secret key is used. "
nil t) nil t)
(y-or-n-p "Make a detached signature? ")) (y-or-n-p "Make a detached signature? ")))
(setq file-list (cdr file-list))) (revert-buffer))
(revert-buffer)))
;;;###autoload ;;;###autoload
(defun epa-dired-do-encrypt () (defun epa-dired-do-encrypt ()
"Encrypt marked files." "Encrypt marked files."
(interactive) (interactive)
(let ((file-list (dired-get-marked-files))) (dolist (file (dired-get-marked-files))
(while file-list (epa-encrypt-file
(epa-encrypt-file (expand-file-name file)
(expand-file-name (car file-list)) (epa-select-keys (epg-make-context) "Select recipients for encryption.
(epa-select-keys (epg-make-context) "Select recipients for encryption. If no one is selected, symmetric encryption will be performed. ")))
If no one is selected, symmetric encryption will be performed. ")) (revert-buffer))
(setq file-list (cdr file-list)))
(revert-buffer)))
(provide 'epa-dired) (provide 'epa-dired)

View file

@ -40,9 +40,9 @@ Note that this option has no effect if you use GnuPG 2.0."
(defcustom epa-file-select-keys nil (defcustom epa-file-select-keys nil
"Control whether or not to pop up the key selection dialog. "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 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." encryption is used."
:type '(choice (const :tag "Ask always" t) :type '(choice (const :tag "Ask always" t)
(const :tag "Ask when recipients are not set" nil) (const :tag "Ask when recipients are not set" nil)
@ -51,16 +51,6 @@ encryption is used."
(defvar epa-file-passphrase-alist nil) (defvar epa-file-passphrase-alist nil)
(eval-and-compile
(if (fboundp 'encode-coding-string)
(defalias 'epa-file--encode-coding-string 'encode-coding-string)
(defalias 'epa-file--encode-coding-string 'identity)))
(eval-and-compile
(if (fboundp 'decode-coding-string)
(defalias 'epa-file--decode-coding-string 'decode-coding-string)
(defalias 'epa-file--decode-coding-string 'identity)))
(defun epa-file-passphrase-callback-function (context key-id file) (defun epa-file-passphrase-callback-function (context key-id file)
(if (and epa-file-cache-passphrase-for-symmetric-encryption (if (and epa-file-cache-passphrase-for-symmetric-encryption
(eq key-id 'SYM)) (eq key-id 'SYM))
@ -71,8 +61,8 @@ encryption is used."
(or (copy-sequence (cdr entry)) (or (copy-sequence (cdr entry))
(progn (progn
(unless entry (unless entry
(setq entry (list file) (setq entry (list file))
epa-file-passphrase-alist (setq epa-file-passphrase-alist
(cons entry (cons entry
epa-file-passphrase-alist))) epa-file-passphrase-alist)))
(setq passphrase (epa-passphrase-callback-function context (setq passphrase (epa-passphrase-callback-function context
@ -236,11 +226,7 @@ encryption is used."
(setq file (expand-file-name file)) (setq file (expand-file-name file))
(let* ((coding-system (or coding-system-for-write (let* ((coding-system (or coding-system-for-write
(if (fboundp 'select-safe-coding-system) (if (fboundp 'select-safe-coding-system)
;; This is needed since Emacs 22 has (let ((buffer-file-name file))
;; no-conversion setting for *.gpg in
;; `auto-coding-alist'.
(let ((buffer-file-name
(file-name-sans-extension file)))
(select-safe-coding-system (select-safe-coding-system
(point-min) (point-max))) (point-min) (point-max)))
buffer-file-coding-system))) buffer-file-coding-system)))
@ -266,7 +252,7 @@ encryption is used."
(epg-encrypt-string (epg-encrypt-string
context context
(if (stringp start) (if (stringp start)
(epa-file--encode-coding-string start coding-system) (encode-coding-string start coding-system)
(unless start (unless start
(setq start (point-min) (setq start (point-min)
end (point-max))) end (point-max)))
@ -280,8 +266,8 @@ encryption is used."
;; decrypted contents. ;; decrypted contents.
(format-encode-buffer (with-current-buffer buffer (format-encode-buffer (with-current-buffer buffer
buffer-file-format)) buffer-file-format))
(epa-file--encode-coding-string (buffer-string) (encode-coding-string (buffer-string)
coding-system))) coding-system)))
(if (or (eq epa-file-select-keys t) (if (or (eq epa-file-select-keys t)
(and (null epa-file-select-keys) (and (null epa-file-select-keys)
(not (local-variable-p 'epa-file-encrypt-to (not (local-variable-p 'epa-file-encrypt-to

View file

@ -35,10 +35,10 @@
(defcustom epa-file-name-regexp (purecopy "\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'") (defcustom epa-file-name-regexp (purecopy "\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'")
"Regexp which matches filenames to be encrypted with GnuPG. "Regexp which matches filenames to be encrypted with GnuPG.
If you set this outside Custom while epa-file is already enabled, you If you set this outside Custom while epa-file is already enabled,
have to call `epa-file-name-regexp-update' after setting it to you have to call `epa-file-name-regexp-update' after setting it
properly update file-name-handler-alist. Setting this through Custom to properly update `file-name-handler-alist'. Setting this
does that automatically." through Custom does that automatically."
:type 'regexp :type 'regexp
:group 'epa-file :group 'epa-file
:set 'epa-file--file-name-regexp-set) :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)) (list epa-file-name-regexp nil 'epa-file))
(defun epa-file-name-regexp-update () (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) (interactive)
(unless (equal (car epa-file-handler) epa-file-name-regexp) (unless (equal (car epa-file-handler) epa-file-name-regexp)
(setcar epa-file-handler epa-file-name-regexp))) (setcar epa-file-handler epa-file-name-regexp)))

View file

@ -25,7 +25,9 @@
(require 'epg) (require 'epg)
(require 'font-lock) (require 'font-lock)
(require 'widget) (require 'widget)
(eval-when-compile (require 'wid-edit)) (eval-when-compile
(require 'subr-x)
(require 'wid-edit))
(require 'derived) (require 'derived)
(defgroup epa nil (defgroup epa nil
@ -56,11 +58,6 @@ If neither t nor nil, ask user for confirmation."
:type 'integer :type 'integer
:group 'epa) :group 'epa)
(defgroup epa-faces nil
"Faces for epa-mode."
:version "23.1"
:group 'epa)
(defcustom epa-mail-aliases nil (defcustom epa-mail-aliases nil
"Alist of aliases of email addresses that stand for encryption keys. "Alist of aliases of email addresses that stand for encryption keys.
Each element is a list of email addresses (ALIAS EXPANSIONS...). Each element is a list of email addresses (ALIAS EXPANSIONS...).
@ -76,6 +73,11 @@ The command `epa-mail-encrypt' uses this."
:group 'epa :group 'epa
:version "24.4") :version "24.4")
(defgroup epa-faces nil
"Faces for epa-mode."
:version "23.1"
:group 'epa)
(defface epa-validity-high (defface epa-validity-high
'((default :weight bold) '((default :weight bold)
(((class color) (background dark)) :foreground "PaleTurquoise")) (((class color) (background dark)) :foreground "PaleTurquoise"))
@ -117,13 +119,15 @@ The command `epa-mail-encrypt' uses this."
'((default :weight bold) '((default :weight bold)
(((class color) (background dark)) :foreground "PaleTurquoise")) (((class color) (background dark)) :foreground "PaleTurquoise"))
"Face for the name of the attribute field." "Face for the name of the attribute field."
:group 'epa) :version "28.1"
:group 'epa-faces)
(defface epa-field-body (defface epa-field-body
'((default :slant italic) '((default :slant italic)
(((class color) (background dark)) :foreground "turquoise")) (((class color) (background dark)) :foreground "turquoise"))
"Face for the body of the attribute field." "Face for the body of the attribute field."
:group 'epa) :version "28.1"
:group 'epa-faces)
(defcustom epa-validity-face-alist (defcustom epa-validity-face-alist
'((unknown . epa-validity-disabled) '((unknown . epa-validity-disabled)
@ -138,8 +142,9 @@ The command `epa-mail-encrypt' uses this."
(full . epa-validity-high) (full . epa-validity-high)
(ultimate . epa-validity-high)) (ultimate . epa-validity-high))
"An alist mapping validity values to faces." "An alist mapping validity values to faces."
:version "28.1"
:type '(repeat (cons symbol face)) :type '(repeat (cons symbol face))
:group 'epa) :group 'epa-faces)
(defvar epa-font-lock-keywords (defvar epa-font-lock-keywords
'(("^\\*" '(("^\\*"
@ -185,6 +190,8 @@ You should bind this variable with `let', but do not set it globally.")
(defvar epa-key-list-mode-map (defvar epa-key-list-mode-map
(let ((keymap (make-sparse-keymap)) (let ((keymap (make-sparse-keymap))
(menu-map (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 "m" 'epa-mark-key)
(define-key keymap "u" 'epa-unmark-key) (define-key keymap "u" 'epa-unmark-key)
(define-key keymap "d" 'epa-decrypt-file) (define-key keymap "d" 'epa-decrypt-file)
@ -332,8 +339,7 @@ If ARG is non-nil, mark the key."
(epa-mark-key (not arg))) (epa-mark-key (not arg)))
(defun epa-exit-buffer () (defun epa-exit-buffer ()
"Exit the current buffer. "Exit the current buffer using `epa-exit-buffer-function'."
`epa-exit-buffer-function' is called if it is set."
(interactive) (interactive)
(funcall epa-exit-buffer-function)) (funcall epa-exit-buffer-function))
@ -397,8 +403,7 @@ DOC is documentation text to insert at the start."
(goto-char point)) (goto-char point))
(epa--insert-keys (epg-list-keys context name secret)) (epa--insert-keys (epg-list-keys context name secret))
(widget-setup) (widget-setup))
(set-keymap-parent (current-local-map) widget-keymap))
(make-local-variable 'epa-list-keys-arguments) (make-local-variable 'epa-list-keys-arguments)
(setq epa-list-keys-arguments (list name secret)) (setq epa-list-keys-arguments (list name secret))
(goto-char (point-min)) (goto-char (point-min))
@ -500,6 +505,14 @@ If SECRET is non-nil, list secret keys instead of public keys."
(let ((keys (epg-list-keys context names secret))) (let ((keys (epg-list-keys context names secret)))
(epa--select-keys prompt keys))) (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) (defun epa--show-key (key)
(let* ((primary-sub-key (car (epg-key-sub-key-list key))) (let* ((primary-sub-key (car (epg-key-sub-key-list key)))
(entry (assoc (epg-sub-key-id primary-sub-key) (entry (assoc (epg-sub-key-id primary-sub-key)

View file

@ -202,13 +202,13 @@ version requirement is met."
(cond (cond
((eq type 'group) ((eq type 'group)
(if (string-match "\\`\\([^:]+\\):" args) (if (string-match "\\`\\([^:]+\\):" args)
(setq groups (setq groups
(cons (cons (downcase (match-string 1 args)) (cons (cons (downcase (match-string 1 args))
(delete "" (split-string (delete "" (split-string
(substring args (substring args
(match-end 0)) (match-end 0))
";"))) ";")))
groups)) groups))
(if epg-debug (if epg-debug
(message "Invalid group configuration: %S" args)))) (message "Invalid group configuration: %S" args))))
((memq type '(pubkey cipher digest compress)) ((memq type '(pubkey cipher digest compress))