aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2011-08-15 21:40:26 -0400
committerRichard M. Stallman2011-08-15 21:40:26 -0400
commit3a99bf64df4071fc6910876070215a948c18aa01 (patch)
tree059d0c2dcc975240889a66c6fd0d7ee380ded17b
parent3ebec5517ea32d0c9d1954f0ea806b4fb256f12e (diff)
downloademacs-3a99bf64df4071fc6910876070215a948c18aa01.tar.gz
emacs-3a99bf64df4071fc6910876070215a948c18aa01.zip
Bug fix for finding coding system. New COPY-FUNCTION feature
for epa-decrypt-region.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/epa.el30
2 files changed, 26 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7116a152605..053f9d3bab6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12011-08-16 Richard Stallman <rms@gnu.org>
2
3 * epa.el (epa-decrypt-region): New arg COPY-FUNCTION.
4 (epa--find-coding-system-for-mime-charset): Fix the non-xemacs case.
5 (epa-decrypt-armor-in-region): Make error message clearer.
6
12011-08-15 Stefan Monnier <monnier@iro.umontreal.ca> 72011-08-15 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 * minibuffer.el (completion-pcm--merge-completions): Don't merge "a1b" 9 * minibuffer.el (completion-pcm--merge-completions): Don't merge "a1b"
diff --git a/lisp/epa.el b/lisp/epa.el
index e2fafc753d7..5611379ea51 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -803,10 +803,12 @@ If no one is selected, symmetric encryption will be performed. ")))
803 (file-name-nondirectory cipher)))) 803 (file-name-nondirectory cipher))))
804 804
805;;;###autoload 805;;;###autoload
806(defun epa-decrypt-region (start end) 806(defun epa-decrypt-region (start end &optional copy-function)
807 "Decrypt the current region between START and END. 807 "Decrypt the current region between START and END.
808If COPY-FUNCTION is non-nil, call it to copy the current buffer
809into some other buffer for the output; it should return that buffer.
808 810
809Don't use this command in Lisp programs! 811Be careful about using this command in Lisp programs!
810Since this function operates on regions, it does some tricks such 812Since this function operates on regions, it does some tricks such
811as coding-system detection and unibyte/multibyte conversion. If 813as coding-system detection and unibyte/multibyte conversion. If
812you are sure how the data in the region should be treated, you 814you are sure how the data in the region should be treated, you
@@ -844,10 +846,17 @@ For example:
844 (delete-region start end) 846 (delete-region start end)
845 (goto-char start) 847 (goto-char start)
846 (insert plain)) 848 (insert plain))
847 (with-output-to-temp-buffer "*Temp*" 849 (if copy-function
848 (set-buffer standard-output) 850 (with-current-buffer (funcall copy-function)
849 (insert plain) 851 (let ((inhibit-read-only t)
850 (epa-info-mode))) 852 buffer-read-only)
853 (delete-region start end)
854 (goto-char start)
855 (insert plain)))
856 (with-output-to-temp-buffer "*Temp*"
857 (set-buffer standard-output)
858 (insert plain)
859 (epa-info-mode))))
851 (if (epg-context-result-for context 'verify) 860 (if (epg-context-result-for context 'verify)
852 (epa-display-info (epg-verify-result-to-string 861 (epa-display-info (epg-verify-result-to-string
853 (epg-context-result-for context 'verify))))))) 862 (epg-context-result-for context 'verify)))))))
@@ -856,12 +865,13 @@ For example:
856 (if (featurep 'xemacs) 865 (if (featurep 'xemacs)
857 (if (fboundp 'find-coding-system) 866 (if (fboundp 'find-coding-system)
858 (find-coding-system mime-charset)) 867 (find-coding-system mime-charset))
868 ;; Find the first coding system which corresponds to MIME-CHARSET.
859 (let ((pointer (coding-system-list))) 869 (let ((pointer (coding-system-list)))
860 (while (and pointer 870 (while (and pointer
861 (eq (coding-system-get (car pointer) 'mime-charset) 871 (not (eq (coding-system-get (car pointer) 'mime-charset)
862 mime-charset)) 872 mime-charset)))
863 (setq pointer (cdr pointer))) 873 (setq pointer (cdr pointer)))
864 pointer))) 874 (car pointer))))
865 875
866;;;###autoload 876;;;###autoload
867(defun epa-decrypt-armor-in-region (start end) 877(defun epa-decrypt-armor-in-region (start end)
@@ -880,7 +890,7 @@ See the reason described in the `epa-decrypt-region' documentation."
880 armor-end (re-search-forward "^-----END PGP MESSAGE-----$" 890 armor-end (re-search-forward "^-----END PGP MESSAGE-----$"
881 nil t)) 891 nil t))
882 (unless armor-end 892 (unless armor-end
883 (error "No armor tail")) 893 (error "Encryption armor beginning has no matching end"))
884 (goto-char armor-start) 894 (goto-char armor-start)
885 (let ((coding-system-for-read 895 (let ((coding-system-for-read
886 (or coding-system-for-read 896 (or coding-system-for-read