From: ueno Date: Mon, 17 Apr 2006 09:28:51 +0000 (+0000) Subject: Check empty validity. X-Git-Tag: epgsm-branchpoint~43 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=4ead1528d539f9ef8c39238cf20e7e51e08f7503;p=elisp%2Fepg.git Check empty validity. --- diff --git a/epa.el b/epa.el index 49ddd4a..75b8934 100644 --- a/epa.el +++ b/epa.el @@ -108,13 +108,14 @@ (?n . epa-validity-low-face) (?m . epa-validity-medium-face) (?f . epa-validity-high-face) - (?u . epa-validity-high-face)) + (?u . epa-validity-high-face) + (? . epa-validity-high-face)) "An alist mapping marks on epa-keys-buffer to faces." :type 'list :group 'epa) (defcustom epa-font-lock-keywords - '(("^[* ]\\(\\([oidreqnmfu-]\\) .*\\)" + '(("^[* ]\\(\\([oidreqnmfu -]\\) .*\\)" (1 (cdr (assq (aref (match-string 2) 0) epa-validity-face-alist)))) ("^\t\\([^\t:]+:\\)[ \t]*\\(.*\\)$" @@ -135,6 +136,7 @@ (defvar epa-keys-buffer nil) (defvar epa-key-buffer-alist nil) (defvar epa-key nil) +(defvar epa-customize-buffer nil) (defvar epa-keys-mode-map (let ((keymap (make-sparse-keymap))) @@ -198,16 +200,16 @@ (setq epa-keys-buffer (generate-new-buffer "*Keys*"))) (set-buffer epa-keys-buffer) (erase-buffer) - (epa-list-keys-1 name) + (epa-list-keys-1 name nil) (epa-keys-mode) (goto-char (point-min)) (pop-to-buffer (current-buffer))) -(defun epa-list-keys-1 (name) +(defun epa-list-keys-1 (name mode) (let ((inhibit-read-only t) buffer-read-only keys point primary-sub-key primary-user-id) - (setq keys (epg-list-keys name)) + (setq keys (epg-list-keys name mode)) (while keys (setq point (point) primary-sub-key (car (epg-key-sub-key-list (car keys))) @@ -248,12 +250,12 @@ (if names (while names (setq point (point)) - (epa-list-keys-1 (car names)) + (epa-list-keys-1 (car names) nil) (goto-char point) (epa-mark) (goto-char (point-max)) (setq names (cdr names))) - (epa-list-keys-1 nil)) + (epa-list-keys-1 nil nil)) (epa-keys-mode) (goto-char (point-min)) (pop-to-buffer (current-buffer)) @@ -319,7 +321,7 @@ (epg-sub-key-creation-time (car pointer)) (if (epg-sub-key-expiration-time (car pointer)) (format "\n\tExpires: %s" (epg-sub-key-expiration-time - (car pointer))) + (car pointer))) "") "\n\tCapabilities: " (mapconcat #'symbol-name @@ -418,6 +420,53 @@ If no one is selected, symmetric encryption will be performed. ")))) cipher) (message "Encrypting %s...done" (file-name-nondirectory file)))) +(defun epa-customize () + (interactive) + (unless (and epa-customize-buffer + (buffer-live-p epa-customize-buffer)) + (setq epa-customize-buffer (generate-new-buffer "*Customize*"))) + (let ((inhibit-read-only t) + buffer-read-only + (configuration (epg-configuration))) + (set-buffer epa-customize-buffer) + (erase-buffer) + (insert (format "GnuPG %s\n\n" (cdr (assq 'version configuration)))) + (insert "Cipher:\n") + (apply #'widget-create 'radio-button-choice + :notify (lambda (widget &rest ignore) + (message "Set %s" (widget-value widget))) + (mapcar + (lambda (algorithm) + (list 'item + :tag (cdr (assq algorithm epg-cipher-algorithm-alist)) + algorithm)) + (cdr (assq 'cipher configuration)))) + (insert "Digest:\n") + (apply #'widget-create 'radio-button-choice + :notify (lambda (widget &rest ignore) + (message "Set %s" (widget-value widget))) + (mapcar + (lambda (algorithm) + (list 'item + :tag (cdr (assq algorithm epg-digest-algorithm-alist)) + algorithm)) + (cdr (assq 'digest configuration)))) + (insert "Compress:\n") + (apply #'widget-create 'radio-button-choice + :notify (lambda (widget &rest ignore) + (message "Set %s" (widget-value widget))) + (mapcar + (lambda (algorithm) + (list 'item + :tag (cdr (assq algorithm epg-compress-algorithm-alist)) + algorithm)) + (cdr (assq 'compress configuration)))) + (insert "\n") + (epa-list-keys-1 nil t) + (epa-keys-mode) + (goto-char (point-min)) + (pop-to-buffer (current-buffer)))) + (provide 'epa) ;;; epa.el ends here diff --git a/epg.el b/epg.el index 243b0a3..abd5d85 100644 --- a/epg.el +++ b/epg.el @@ -107,7 +107,8 @@ (?n . never) (?m . marginal) (?f . full) - (?u . ultimate))) + (?u . ultimate) + (? . empty))) (defvar epg-key-capablity-alist '((?e . encrypt) @@ -755,7 +756,9 @@ This function is for internal use only." (defun epg-make-sub-key-1 (line) (epg-make-sub-key - (cdr (assq (string-to-char (aref line 1)) epg-key-validity-alist)) + (if (aref line 1) + (cdr (assq (string-to-char (aref line 1)) epg-key-validity-alist)) + 'empty) (delq nil (mapcar (lambda (char) (cdr (assq char epg-key-capablity-alist))) (aref line 11))) @@ -780,8 +783,10 @@ This function is for internal use only." (car keys) (nreverse (epg-key-user-id-list (car keys))))) (setq keys (cons (epg-make-key - (cdr (assq (string-to-char (aref (car lines) 8)) - epg-key-validity-alist))) + (if (aref (car lines) 8) + (cdr (assq (string-to-char (aref (car lines) 8)) + epg-key-validity-alist)) + 'empty)) keys)) (epg-key-set-sub-key-list (car keys) @@ -796,8 +801,10 @@ This function is for internal use only." (epg-key-set-user-id-list (car keys) (cons (epg-make-user-id - (cdr (assq (string-to-char (aref (car lines) 1)) - epg-key-validity-alist)) + (if (aref (car lines) 1) + (cdr (assq (string-to-char (aref (car lines) 1)) + epg-key-validity-alist)) + 'empty) (aref (car lines) 9)) (epg-key-user-id-list (car keys))))) ((equal (aref (car lines) 0) "fpr")