diff options
| author | Christian Schwarzgruber | 2015-11-15 22:31:41 +0100 |
|---|---|---|
| committer | Daiki Ueno | 2015-11-19 10:57:37 +0900 |
| commit | ebad964b3afbe5ef77085be94cf566836450c74c (patch) | |
| tree | 357ad9412c142d66e945a967802a33b55ea8ab04 | |
| parent | 5bc966dfdae62cbcb5698f77adffada4fbf445d7 (diff) | |
| download | emacs-ebad964b3afbe5ef77085be94cf566836450c74c.tar.gz emacs-ebad964b3afbe5ef77085be94cf566836450c74c.zip | |
epa.el: Add option to replace original text
* lisp/epa.el (epa-replace-original-text): New user option.
(Bug#21947)
Copyright-paperwork-exempt: yes
| -rw-r--r-- | lisp/epa.el | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lisp/epa.el b/lisp/epa.el index 9f112c4eb83..e51d5d86540 100644 --- a/lisp/epa.el +++ b/lisp/epa.el | |||
| @@ -34,6 +34,17 @@ | |||
| 34 | :link '(custom-manual "(epa) Top") | 34 | :link '(custom-manual "(epa) Top") |
| 35 | :group 'epg) | 35 | :group 'epg) |
| 36 | 36 | ||
| 37 | (defcustom epa-replace-original-text 'ask | ||
| 38 | "Whether the original text shall be replaced by the decrypted. | ||
| 39 | |||
| 40 | If t, replace the original text without any confirmation. | ||
| 41 | If nil, don't replace the original text and show the result in a new buffer. | ||
| 42 | If neither t nor nil, ask user for confirmation." | ||
| 43 | :type '(choice (const :tag "Never" nil) | ||
| 44 | (const :tag "Ask the user" ask) | ||
| 45 | (const :tag "Always" t)) | ||
| 46 | :group 'epa) | ||
| 47 | |||
| 37 | (defcustom epa-popup-info-window t | 48 | (defcustom epa-popup-info-window t |
| 38 | "If non-nil, display status information from epa commands in another window." | 49 | "If non-nil, display status information from epa commands in another window." |
| 39 | :type 'boolean | 50 | :type 'boolean |
| @@ -872,7 +883,9 @@ For example: | |||
| 872 | (with-current-buffer (funcall make-buffer-function) | 883 | (with-current-buffer (funcall make-buffer-function) |
| 873 | (let ((inhibit-read-only t)) | 884 | (let ((inhibit-read-only t)) |
| 874 | (insert plain))) | 885 | (insert plain))) |
| 875 | (if (y-or-n-p "Replace the original text? ") | 886 | (if (or (eq epa-replace-original-text t) |
| 887 | (and epa-replace-original-text | ||
| 888 | (y-or-n-p "Replace the original text? "))) | ||
| 876 | (let ((inhibit-read-only t)) | 889 | (let ((inhibit-read-only t)) |
| 877 | (delete-region start end) | 890 | (delete-region start end) |
| 878 | (goto-char start) | 891 | (goto-char start) |
| @@ -968,7 +981,9 @@ For example: | |||
| 968 | (or coding-system-for-read | 981 | (or coding-system-for-read |
| 969 | (get-text-property start 'epa-coding-system-used) | 982 | (get-text-property start 'epa-coding-system-used) |
| 970 | 'undecided))) | 983 | 'undecided))) |
| 971 | (if (y-or-n-p "Replace the original text? ") | 984 | (if (or (eq epa-replace-original-text t) |
| 985 | (and epa-replace-original-text | ||
| 986 | (y-or-n-p "Replace the original text? "))) | ||
| 972 | (let ((inhibit-read-only t) | 987 | (let ((inhibit-read-only t) |
| 973 | buffer-read-only) | 988 | buffer-read-only) |
| 974 | (delete-region start end) | 989 | (delete-region start end) |