comparison lisp/international/mule.el @ 49376:ed922baa8df3

(decode-coding-region-as-inserted-from-file): New function.
author Kenichi Handa <handa@m17n.org>
date Wed, 22 Jan 2003 02:33:07 +0000
parents b38398e733f4
children c0097d579165
comparison
equal deleted inserted replaced
49375:e97f53aad99e 49376:ed922baa8df3
1897 (setcdr slot coding-system) 1897 (setcdr slot coding-system)
1898 (setq network-coding-system-alist 1898 (setq network-coding-system-alist
1899 (cons (cons regexp coding-system) 1899 (cons (cons regexp coding-system)
1900 network-coding-system-alist))))))) 1900 network-coding-system-alist)))))))
1901 1901
1902 (defun decode-coding-region-as-inserted-from-file (from to filename
1903 &optional
1904 visit beg end replace)
1905 "Decode the region between FROM and TO as if it is read from file FILENAME.
1906 Optional arguments VISIT, BEG, END, and REPLACE are the same as those
1907 of the function `insert-file-contents'."
1908 (save-excursion
1909 (save-restriction
1910 (narrow-to-region from to)
1911 (goto-char (point-min))
1912 (let ((coding coding-system-for-read))
1913 (or coding
1914 (setq coding (funcall set-auto-coding-function
1915 filename (- (point-max) (point-min)))))
1916 (or coding
1917 (setq coding (find-operation-coding-system
1918 'insert-file-contents
1919 filename visit beg end replace)))
1920 (if (coding-system-p coding)
1921 (or enable-multibyte-characters
1922 (setq coding
1923 (coding-system-change-text-conversion coding 'raw-text)))
1924 (setq coding nil))
1925 (if coding
1926 (decode-coding-region (point-min) (point-max) coding))
1927 (setq last-coding-system-used coding)))))
1928
1902 (defun make-translation-table (&rest args) 1929 (defun make-translation-table (&rest args)
1903 "Make a translation table from arguments. 1930 "Make a translation table from arguments.
1904 A translation table is a char table intended for character 1931 A translation table is a char table intended for character
1905 translation in CCL programs. 1932 translation in CCL programs.
1906 1933