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
If the character was composed on display with any following characters
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.
@item

View file

@ -469,7 +469,7 @@ variable @code{imenu-generic-expression}, for the two variables
@code{imenu-create-index-function} (@pxref{Imenu}).
@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
buffer-local entries to the special hook
@code{eldoc-documentation-functions}.

View file

@ -263,7 +263,7 @@ obsolete.
*** 'eldoc-echo-area-use-multiline-p' is now handled by ElDoc.
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
it when producing a doc string.

View file

@ -775,13 +775,16 @@ The character information includes:
(setq glyph (lgstring-glyph gstring from)))
(insert (format " %S\n" glyph))
(setq from (1+ from)))
(insert "from these character(s):\n")
(dotimes (i (lgstring-char-len gstring))
(let ((char (lgstring-char gstring i)))
(when (and (stringp (car composition))
(string-match "\"\\([^\"]+\\)\"" (car composition)))
(insert "with these character(s):\n")
(let ((chars (match-string 1 (car composition))))
(dotimes (i (length chars))
(let ((char (aref chars i)))
(insert (format " %c (#x%x) %s\n"
char char
(get-char-code-property
char 'name))))))
char 'name))))))))
;; TTY frame: show composition in terms of characters.
(insert " by these characters:\n")
(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
;; exclusively, we could call the (now unused) argument
;; _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.
(describe-char-eldoc--format
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
semantics of `max-mini-window-height', constraining the resizing
for Eldoc purposes only.
for ElDoc purposes only.
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)))
(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
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
always holds the full documentation."
:type 'boolean)
@ -495,8 +495,9 @@ Honor most of `eldoc-echo-area-use-multiline-p'."
(substitute-command-keys "\\[eldoc-doc-buffer]")))))))))
((= available 1)
;; Truncate "brutally." ; FIXME: use `eldoc-prefer-doc-buffer' too?
(with-current-buffer (eldoc-doc-buffer)
(truncate-string-to-width
(buffer-substring (point-min) (line-end-position 1)) width)))))
(buffer-substring (point-min) (line-end-position 1)) width))))))
(when 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))
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
;; `eldoc-documentation-strategy', so we do the reverse. This allows
;; for Eldoc to be loaded in those older Emacs versions and work with
;; whomever (major-modes, extensions, ueser) sets one of the other
;; for ElDoc to be loaded in those older Emacs versions and work with
;; whomever (major-modes, extensions, user) sets one or the other
;; variable.
(defmacro eldoc--documentation-strategy-defcustom
(main secondary value docstring &rest more)

View file

@ -29,48 +29,40 @@
(defun epa-dired-do-decrypt ()
"Decrypt marked files."
(interactive)
(let ((file-list (dired-get-marked-files)))
(while file-list
(epa-decrypt-file (expand-file-name (car file-list)))
(setq file-list (cdr file-list)))
(revert-buffer)))
(dolist (file (dired-get-marked-files))
(epa-decrypt-file (expand-file-name file)))
(revert-buffer))
;;;###autoload
(defun epa-dired-do-verify ()
"Verify marked files."
(interactive)
(let ((file-list (dired-get-marked-files)))
(while file-list
(epa-verify-file (expand-file-name (car file-list)))
(setq file-list (cdr file-list)))))
(dolist (file (dired-get-marked-files))
(epa-verify-file (expand-file-name file))))
;;;###autoload
(defun epa-dired-do-sign ()
"Sign marked files."
(interactive)
(let ((file-list (dired-get-marked-files)))
(while file-list
(dolist (file (dired-get-marked-files))
(epa-sign-file
(expand-file-name (car file-list))
(expand-file-name file)
(epa-select-keys (epg-make-context) "Select keys for signing.
If no one is selected, default secret key is used. "
nil t)
(y-or-n-p "Make a detached signature? "))
(setq file-list (cdr file-list)))
(revert-buffer)))
(y-or-n-p "Make a detached signature? ")))
(revert-buffer))
;;;###autoload
(defun epa-dired-do-encrypt ()
"Encrypt marked files."
(interactive)
(let ((file-list (dired-get-marked-files)))
(while file-list
(dolist (file (dired-get-marked-files))
(epa-encrypt-file
(expand-file-name (car file-list))
(expand-file-name file)
(epa-select-keys (epg-make-context) "Select recipients for encryption.
If no one is selected, symmetric encryption will be performed. "))
(setq file-list (cdr file-list)))
(revert-buffer)))
If no one is selected, symmetric encryption will be performed. ")))
(revert-buffer))
(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
"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)
@ -51,16 +51,6 @@ encryption is used."
(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)
(if (and epa-file-cache-passphrase-for-symmetric-encryption
(eq key-id 'SYM))
@ -71,8 +61,8 @@ encryption is used."
(or (copy-sequence (cdr entry))
(progn
(unless entry
(setq entry (list file)
epa-file-passphrase-alist
(setq entry (list file))
(setq epa-file-passphrase-alist
(cons entry
epa-file-passphrase-alist)))
(setq passphrase (epa-passphrase-callback-function context
@ -236,11 +226,7 @@ encryption is used."
(setq file (expand-file-name file))
(let* ((coding-system (or coding-system-for-write
(if (fboundp 'select-safe-coding-system)
;; This is needed since Emacs 22 has
;; no-conversion setting for *.gpg in
;; `auto-coding-alist'.
(let ((buffer-file-name
(file-name-sans-extension file)))
(let ((buffer-file-name file))
(select-safe-coding-system
(point-min) (point-max)))
buffer-file-coding-system)))
@ -266,7 +252,7 @@ encryption is used."
(epg-encrypt-string
context
(if (stringp start)
(epa-file--encode-coding-string start coding-system)
(encode-coding-string start coding-system)
(unless start
(setq start (point-min)
end (point-max)))
@ -280,7 +266,7 @@ encryption is used."
;; decrypted contents.
(format-encode-buffer (with-current-buffer buffer
buffer-file-format))
(epa-file--encode-coding-string (buffer-string)
(encode-coding-string (buffer-string)
coding-system)))
(if (or (eq epa-file-select-keys t)
(and (null epa-file-select-keys)

View file

@ -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)))

View file

@ -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
@ -56,11 +58,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 +73,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"))
@ -117,13 +119,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 +142,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
'(("^\\*"
@ -185,6 +190,8 @@ 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 "\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)
@ -332,8 +339,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))
@ -397,8 +403,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))
@ -500,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)