2002-10-10 Simon Josefsson <jas@extundo.com>
+ * pgg.el (pgg-decrypt-region): Bind pgg-default-user-id to
+ key-identifier in packet. Is this a good idea?
+
* mml.el (mml-mode-map): Add security commands that operates on
MIME parts.
(mml-menu): And menu items for them.
(defun pgg-decrypt-region (start end)
"Decrypt the current region between START and END."
(interactive "r")
- (let ((status
- (pgg-save-coding-system start end
- (pgg-invoke "decrypt-region" (or pgg-scheme pgg-default-scheme)
- (point-min) (point-max)))))
+ (let* ((buf (current-buffer))
+ (packet (cdr (assq 1 (with-temp-buffer
+ (insert-buffer buf)
+ (pgg-decode-armor-region
+ (point-min) (point-max))))))
+ (key (cdr (assq 'key-identifier packet)))
+ (pgg-default-user-id
+ (if key
+ (concat "0x" (pgg-truncate-key-identifier key))
+ pgg-default-user-id))
+ (status
+ (pgg-save-coding-system start end
+ (pgg-invoke "decrypt-region" (or pgg-scheme pgg-default-scheme)
+ (point-min) (point-max)))))
(when (interactive-p)
(pgg-display-output-buffer start end status))
status))