diff options
| author | Kenichi Handa | 2003-01-22 02:33:07 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2003-01-22 02:33:07 +0000 |
| commit | f29387e80b31f675b8e54516ab94b1eca157b730 (patch) | |
| tree | b0af5fca7ed8dcf1b3b62e6725bbf739376eeb86 | |
| parent | 7b997a977e6271d9fd3e4d15bb755889727d3e0a (diff) | |
| download | emacs-f29387e80b31f675b8e54516ab94b1eca157b730.tar.gz emacs-f29387e80b31f675b8e54516ab94b1eca157b730.zip | |
(decode-coding-region-as-inserted-from-file): New function.
| -rw-r--r-- | lisp/international/mule.el | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 909ba315b77..aa14f442bd0 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -1899,6 +1899,33 @@ or a function symbol which, when called, returns such a cons cell." | |||
| 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 |