(make-local-variable 'epa-exit-buffer-function)
(run-hooks 'epa-key-mode-hook))
+(defun epa-info-mode ()
+ "Major mode for `epa-info-buffer'."
+ (kill-all-local-variables)
+ (buffer-disable-undo)
+ (setq major-mode 'epa-info-mode
+ mode-name "Info"
+ truncate-lines t
+ buffer-read-only t)
+ (use-local-map epa-info-mode-map)
+ (run-hooks 'epa-info-mode-hook))
+
+(defun epa-mark (&optional arg)
+ "Mark the current line.
+If ARG is non-nil, unmark the current line."
+ (interactive "P")
+ (let ((inhibit-read-only t)
+ buffer-read-only
+ properties)
+ (beginning-of-line)
+ (setq properties (text-properties-at (point)))
+ (delete-char 1)
+ (insert (if arg " " "*"))
+ (set-text-properties (1- (point)) (point) properties)
+ (forward-line)))
+
+(defun epa-unmark (&optional arg)
+ "Unmark the current line.
+If ARG is non-nil, mark the current line."
+ (interactive "P")
+ (epa-mark (not arg)))
+
+(defun epa-toggle-mark ()
+ "Toggle the mark the current line."
+ (interactive)
+ (epa-mark (eq (char-after (save-excursion (beginning-of-line) (point))) ?*)))
+
+(defun epa-exit-buffer ()
+ "Exit the current buffer.
+`epa-exit-buffer-function' is called if it is set."
+ (interactive)
+ (funcall epa-exit-buffer-function))
+
;;;###autoload
(defun epa-list-keys (&optional name mode protocol)
(interactive
(defun epa-show-key-notify (widget &rest ignore)
(epa-show-key (widget-get widget :value)))
-(defun epa-mark (&optional arg)
- "Mark the current line.
-If ARG is non-nil, unmark the current line."
- (interactive "P")
- (let ((inhibit-read-only t)
- buffer-read-only
- properties)
- (beginning-of-line)
- (setq properties (text-properties-at (point)))
- (delete-char 1)
- (insert (if arg " " "*"))
- (set-text-properties (1- (point)) (point) properties)
- (forward-line)))
-
-(defun epa-unmark (&optional arg)
- "Unmark the current line.
-If ARG is non-nil, mark the current line."
- (interactive "P")
- (epa-mark (not arg)))
-
-(defun epa-toggle-mark ()
- "Toggle the mark the current line."
- (interactive)
- (epa-mark (eq (char-after (save-excursion (beginning-of-line) (point))) ?*)))
-
-(defun epa-exit-buffer ()
- "Exit the current buffer.
-`epa-exit-buffer-function' is called if it is set."
- (interactive)
- (funcall epa-exit-buffer-function))
-
(defun epa-display-verify-result (verify-result)
(if epa-popup-info-window
(progn
(goto-char (point-min)))
(message "%s" (epg-verify-result-to-string verify-result))))
-(defun epa-info-mode ()
- "Major mode for `epa-info-buffer'."
- (kill-all-local-variables)
- (buffer-disable-undo)
- (setq major-mode 'epa-info-mode
- mode-name "Info"
- truncate-lines t
- buffer-read-only t)
- (use-local-map epa-info-mode-map)
- (run-hooks 'epa-info-mode-hook))
+(defun epa-passphrase-callback-function (context key-id handback)
+ (if (eq key-id 'SYM)
+ (read-passwd "Passphrase for symmetric encryption: "
+ (eq (epg-context-operation context) 'encrypt))
+ (read-passwd
+ (if (eq key-id 'PIN)
+ "Passphrase for PIN: "
+ (let ((entry (assoc key-id epg-user-id-alist)))
+ (if entry
+ (format "Passphrase for %s %s: " key-id (cdr entry))
+ (format "Passphrase for %s: " key-id)))))))
+
+(defun epa-progress-callback-function (context what char current total
+ handback)
+ (message "%s: %d%% (%d/%d)" what
+ (if (> total 0) (floor (* (/ current (float total)) 100)) 0)
+ current total))
;;;###autoload
(defun epa-decrypt-file (file)
(epg-sign-keys context keys local)
(message "Signing keys...done")))
-(defun epa-passphrase-callback-function (context key-id handback)
- (if (eq key-id 'SYM)
- (read-passwd "Passphrase for symmetric encryption: "
- (eq (epg-context-operation context) 'encrypt))
- (read-passwd
- (if (eq key-id 'PIN)
- "Passphrase for PIN: "
- (let ((entry (assoc key-id epg-user-id-alist)))
- (if entry
- (format "Passphrase for %s %s: " key-id (cdr entry))
- (format "Passphrase for %s: " key-id)))))))
-
-(defun epa-progress-callback-function (context what char current total
- handback)
- (message "%s: %d%% (%d/%d)" what
- (if (> total 0) (floor (* (/ current (float total)) 100)) 0)
- current total))
-
(provide 'epa)
;;; epa.el ends here