[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/pinentry 908344f 05/18: Add more documentation and fix
From: |
Stefan Monnier |
Subject: |
[elpa] externals/pinentry 908344f 05/18: Add more documentation and fix mnemonic handling |
Date: |
Sat, 28 Nov 2020 00:07:46 -0500 (EST) |
branch: externals/pinentry
commit 908344f8f2a8756c07c9b9ed14d35fda50dab84d
Author: Daiki Ueno <ueno@gnu.org>
Commit: Daiki Ueno <ueno@gnu.org>
Add more documentation and fix mnemonic handling
---
pinentry.el | 48 ++++++++++++++++++++++++++++++++++++------------
1 file changed, 36 insertions(+), 12 deletions(-)
diff --git a/pinentry.el b/pinentry.el
index 1af7ec6..17204ba 100644
--- a/pinentry.el
+++ b/pinentry.el
@@ -21,6 +21,22 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+;;; Commentary:
+
+;; This package enables GnuPG passphrase input from the minibuffer,
+;; instead of graphical prompt. To use, add allow-emacs-pinentry to
+;; your ~/.gnupg/gpg-agent.conf, and start the server with M-x
+;; pinentry-start.
+;;
+;; The actual comminication between the relevant components is follows:
+;;
+;; gpg --> gpg-agent --> pinentry --> Emacs
+;;
+;; where the communication between pinentry and Emacs are done through
+;; a Unix domain socket located under $TMPDIR/emacs$UID/ (the same
+;; directory as server.el uses). The protocol is basically the same
+;; as the Pinentry Assuan protocol.
+
;;; Code:
(defvar pinentry--server-process nil)
@@ -43,6 +59,7 @@ If local sockets are not supported, this is nil.")
"SETREPEAT" "SETREPEATERROR"
"SETOK" "SETCANCEL" "SETNOTOK"))
+;; These error codes are defined in libgpg-error/src/err-codes.h.in.
(defmacro pinentry--error-code (code)
(logior (lsh 5 24) code))
(defconst pinentry--error-not-implemented
@@ -56,7 +73,10 @@ If local sockets are not supported, this is nil.")
;;;###autoload
(defun pinentry-start ()
- "Start a Pinentry service."
+ "Start a Pinentry service.
+
+Once the environment is properly set, subsequent invocations of
+the gpg command will interact with Emacs for passphrase input."
(interactive)
(unless (featurep 'make-network-process '(:family local))
(error "local sockets are not supported"))
@@ -92,19 +112,23 @@ If local sockets are not supported, this is nil.")
(setq pinentry--connection-process-list nil))
(defun pinentry--labels-to-shortcuts (labels)
+ "Convert strings in LABEL by stripping mnemonics."
(mapcar (lambda (label)
(when label
- (if (string-match "_\\([[:alnum:]]\\)" label)
- (let* ((key (match-string 1 label))
- (c (downcase (aref key 0))))
- (setq label (replace-match
- (propertize key 'face 'underline)
- t t label))
- (cons c label))
- (cons (if (= (length label) 0)
- ??
- (downcase (aref 0 label)))
- label))))
+ (let (c)
+ (if (string-match "\\(?:\\`\\|[^_]\\)_\\([[:alnum:]]\\)" label)
+ (let ((key (match-string 1 label)))
+ (setq c (downcase (aref key 0)))
+ (setq label (replace-match
+ (propertize key 'face 'underline)
+ t t label)))
+ (setq c (if (= (length label) 0)
+ ??
+ (downcase (aref label 0)))))
+ ;; Double underscores mean a single underscore.
+ (when (string-match "__" label)
+ (setq label (replace-match "_" t t label)))
+ (cons c label))))
labels))
(defun pinentry--escape-string (string)
- [elpa] externals/pinentry 88098c1 02/18: Add README, (continued)
- [elpa] externals/pinentry 88098c1 02/18: Add README, Stefan Monnier, 2020/11/28
- [elpa] externals/pinentry ef0d62b 04/18: Add "Version:" header, Stefan Monnier, 2020/11/28
- [elpa] externals/pinentry 9c2949c 03/18: Update README, Stefan Monnier, 2020/11/28
- [elpa] externals/pinentry 075deb6 06/18: Improve documentation, Stefan Monnier, 2020/11/28
- [elpa] externals/pinentry 398bb40 10/18: pinentry.el: Support external passphrase cache, Stefan Monnier, 2020/11/28
- [elpa] externals/pinentry b3a45a5 07/18: Move the content of README to pinentry.el, Stefan Monnier, 2020/11/28
- [elpa] externals/pinentry 99be264 08/18: pinentry.el: Popup window for multiline prompt, Stefan Monnier, 2020/11/28
- [elpa] externals/pinentry 3b6383e 14/18: Suppress redundant Pinentry startup messages, Stefan Monnier, 2020/11/28
- [elpa] externals/pinentry 3f3150b 15/18: Mention how to enable pinentry feature, Stefan Monnier, 2020/11/28
- [elpa] externals/pinentry 9e64733 09/18: ; pinentry.el: Update header comment and fix typos, Stefan Monnier, 2020/11/28
- [elpa] externals/pinentry 908344f 05/18: Add more documentation and fix mnemonic handling,
Stefan Monnier <=
- [elpa] externals/pinentry ee7d272 11/18: Revert "pinentry.el: Support external passphrase cache", Stefan Monnier, 2020/11/28
- [elpa] externals/pinentry f6785ae 12/18: pinentry.el: Improve multiline prompt, Stefan Monnier, 2020/11/28
- [elpa] externals/pinentry 33aa267 13/18: pinentry.el: Add debugging support, Stefan Monnier, 2020/11/28
- [elpa] externals/pinentry 075fa1d 16/18: Change the default socket location for pinentry, Stefan Monnier, 2020/11/28
- [elpa] externals/pinentry 379bbeb 17/18: Revert "Change the default socket location for pinentry", Stefan Monnier, 2020/11/28
- [elpa] externals/pinentry 0f42e75 18/18: Set file modes of pinentry socket for extra safety, Stefan Monnier, 2020/11/28