aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2004-12-29 01:25:15 +0000
committerKenichi Handa2004-12-29 01:25:15 +0000
commit27a91cf7c3e70cb169d6a442064a632b8cea55ec (patch)
tree4ae8321f433bbcc491198dcefd7f552940ee0aa3
parenta2c7e69a185a44f5dd5efde2ab145422ad392a8a (diff)
downloademacs-27a91cf7c3e70cb169d6a442064a632b8cea55ec.tar.gz
emacs-27a91cf7c3e70cb169d6a442064a632b8cea55ec.zip
(recode-region): New function.
-rw-r--r--lisp/international/mule.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 144bd0360ca..ea227ea7e9f 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -1924,6 +1924,25 @@ Part of the job of this function is setting `buffer-undo-list' appropriately."
1924 (setq buffer-undo-list 1924 (setq buffer-undo-list
1925 (cons (cons from (point-max)) undo-list-saved)))))))) 1925 (cons (cons from (point-max)) undo-list-saved))))))))
1926 1926
1927(defun recode-region (start end new-coding coding)
1928 "Re-decode the region (previously decoded by CODING) by NEW-CODING."
1929 (interactive
1930 (list (region-beginning) (region-end)
1931 (read-coding-system "Text was really in: ")
1932 (let ((coding (or buffer-file-coding-system last-coding-system-used)))
1933 (read-coding-system
1934 (concat "But was interpreted as"
1935 (if coding (format " (default %S): " coding) ": "))
1936 coding))))
1937 (or (and new-coding coding)
1938 (error "Coding system not specified"))
1939 ;; Check it before we encode the region.
1940 (check-coding-system new-coding)
1941 (save-restriction
1942 (narrow-to-region start end)
1943 (encode-coding-region (point-min) (point-max) coding)
1944 (decode-coding-region (point-min) (point-max) new-coding)))
1945
1927(defun make-translation-table (&rest args) 1946(defun make-translation-table (&rest args)
1928 "Make a translation table from arguments. 1947 "Make a translation table from arguments.
1929A translation table is a char table intended for character 1948A translation table is a char table intended for character