diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/international/mule.el | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index a17221e6d21..ed74fdae755 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -1806,6 +1806,9 @@ or nil." | |||
| 1806 | (setq alist (cdr alist))))) | 1806 | (setq alist (cdr alist))))) |
| 1807 | coding-system))) | 1807 | coding-system))) |
| 1808 | 1808 | ||
| 1809 | (defvar auto-coding-file-name nil | ||
| 1810 | "Variable holding the name of the file for `auto-coding-functions'.") | ||
| 1811 | |||
| 1809 | ;; See the bottom of this file for built-in auto coding functions. | 1812 | ;; See the bottom of this file for built-in auto coding functions. |
| 1810 | (defcustom auto-coding-functions '(sgml-xml-auto-coding-function | 1813 | (defcustom auto-coding-functions '(sgml-xml-auto-coding-function |
| 1811 | sgml-html-meta-auto-coding-function) | 1814 | sgml-html-meta-auto-coding-function) |
| @@ -1820,6 +1823,9 @@ called both when the file is visited and Emacs wants to decode | |||
| 1820 | its contents, and when the file's buffer is about to be saved | 1823 | its contents, and when the file's buffer is about to be saved |
| 1821 | and Emacs wants to determine how to encode its contents. | 1824 | and Emacs wants to determine how to encode its contents. |
| 1822 | 1825 | ||
| 1826 | The name of the file is provided to the function via the variable | ||
| 1827 | `auto-coding-file-name'. | ||
| 1828 | |||
| 1823 | If one of these functions succeeds in determining a coding | 1829 | If one of these functions succeeds in determining a coding |
| 1824 | system, it should return that coding system. Otherwise, it | 1830 | system, it should return that coding system. Otherwise, it |
| 1825 | should return nil. | 1831 | should return nil. |
| @@ -1847,13 +1853,17 @@ files.") | |||
| 1847 | coding-system)) | 1853 | coding-system)) |
| 1848 | 1854 | ||
| 1849 | (put 'enable-character-translation 'permanent-local t) | 1855 | (put 'enable-character-translation 'permanent-local t) |
| 1850 | (put 'enable-character-translation 'safe-local-variable 'booleanp) | 1856 | (put 'enable-character-translation 'safe-local-variable #'booleanp) |
| 1851 | 1857 | ||
| 1852 | (defun find-auto-coding (filename size) | 1858 | (defun find-auto-coding (filename size) |
| 1859 | ;; FIXME: Shouldn't we use nil rather than "" to mean that there's no file? | ||
| 1860 | ;; FIXME: Clarify what the SOURCE is for in the return value? | ||
| 1853 | "Find a coding system for a file FILENAME of which SIZE bytes follow point. | 1861 | "Find a coding system for a file FILENAME of which SIZE bytes follow point. |
| 1854 | These bytes should include at least the first 1k of the file | 1862 | These bytes should include at least the first 1k of the file |
| 1855 | and the last 3k of the file, but the middle may be omitted. | 1863 | and the last 3k of the file, but the middle may be omitted. |
| 1856 | 1864 | ||
| 1865 | FILENAME should be an absolute file name | ||
| 1866 | or \"\" (which means that there is no associated file). | ||
| 1857 | The function checks FILENAME against the variable `auto-coding-alist'. | 1867 | The function checks FILENAME against the variable `auto-coding-alist'. |
| 1858 | If FILENAME doesn't match any entries in the variable, it checks the | 1868 | If FILENAME doesn't match any entries in the variable, it checks the |
| 1859 | contents of the current buffer following point against | 1869 | contents of the current buffer following point against |
| @@ -1998,7 +2008,8 @@ use \"coding: 'raw-text\" instead." :warning) | |||
| 1998 | (setq coding-system (ignore-errors | 2008 | (setq coding-system (ignore-errors |
| 1999 | (save-excursion | 2009 | (save-excursion |
| 2000 | (goto-char (point-min)) | 2010 | (goto-char (point-min)) |
| 2001 | (funcall (pop funcs) size))))) | 2011 | (let ((auto-coding-file-name filename)) |
| 2012 | (funcall (pop funcs) size)))))) | ||
| 2002 | (if coding-system | 2013 | (if coding-system |
| 2003 | (cons coding-system 'auto-coding-functions))))) | 2014 | (cons coding-system 'auto-coding-functions))))) |
| 2004 | 2015 | ||
| @@ -2013,7 +2024,7 @@ function by default." | |||
| 2013 | (if (and found (coding-system-p (car found))) | 2024 | (if (and found (coding-system-p (car found))) |
| 2014 | (car found)))) | 2025 | (car found)))) |
| 2015 | 2026 | ||
| 2016 | (setq set-auto-coding-function 'set-auto-coding) | 2027 | (setq set-auto-coding-function #'set-auto-coding) |
| 2017 | 2028 | ||
| 2018 | (defun after-insert-file-set-coding (inserted &optional visit) | 2029 | (defun after-insert-file-set-coding (inserted &optional visit) |
| 2019 | "Set `buffer-file-coding-system' of current buffer after text is inserted. | 2030 | "Set `buffer-file-coding-system' of current buffer after text is inserted. |