;;; Code:
+(eval-when-compile (require 'cl)) ; letf
+
(defvar dos-codepage)
(autoload 'widget-value "wid-edit")
(define-key-after map [separator-input-method] '("--"))
(define-key-after map [set-various-coding-system]
- (list 'menu-item "Set Coding Systems" set-coding-system-map
- :enable 'default-enable-multibyte-characters))
+ `(menu-item "Set Coding Systems" ,set-coding-system-map
+ :enable (default-value 'enable-multibyte-characters)))
(define-key-after map [view-hello-file]
'(menu-item "Show Multi-lingual Text" view-hello-file
:enable (file-readable-p
"Display the HELLO file, which lists many languages and characters."
(interactive)
;; We have to decode the file in any environment.
- (let ((default-enable-multibyte-characters t)
- (coding-system-for-read 'iso-2022-7bit))
- (view-file (expand-file-name "HELLO" data-directory))))
+ (letf (((default-value 'enable-multibyte-characters) t)
+ (coding-system-for-read 'iso-2022-7bit))
+ (view-file (expand-file-name "HELLO" data-directory))))
(defun universal-coding-system-argument (coding-system)
"Execute an I/O command using the specified coding system."
(if (eq system-type 'darwin)
;; The file-name coding system on Darwin systems is always utf-8.
(setq default-file-name-coding-system 'utf-8)
- (if (and default-enable-multibyte-characters
+ (if (and (default-value 'enable-multibyte-characters)
(or (not coding-system)
(coding-system-get coding-system 'ascii-compatible-p)))
(setq default-file-name-coding-system coding-system)))
(let ((base (coding-system-base coding-system))
(eol-type (coding-system-eol-type coding-system)))
(set-coding-system-priority base)
- (and (interactive-p)
+ (and (called-interactively-p 'interactive)
(or (eq base coding-system)
(message "Highest priority is set to %s (base of %s)"
base coding-system)))
proper one is suggested as the default.
The list of `buffer-file-coding-system' of the current buffer, the
-`default-buffer-file-coding-system', and the most preferred coding
+default `buffer-file-coding-system', and the most preferred coding
system (if it corresponds to a MIME charset) is treated as the
default coding system list. Among them, the first one that safely
encodes the text is normally selected silently and returned without
list of coding systems to be prepended to the default coding system
list. However, if DEFAULT-CODING-SYSTEM is a list and the first
element is t, the cdr part is used as the default coding system list,
-i.e. `buffer-file-coding-system', `default-buffer-file-coding-system',
+i.e. current `buffer-file-coding-system', default `buffer-file-coding-system',
and the most preferred coding system are not used.
Optional 4th arg ACCEPT-DEFAULT-P, if non-nil, is a function to
(let ((no-other-defaults nil)
auto-cs)
(unless (or (stringp from) find-file-literally)
- ;; Find an auto-coding that is specified for the the current
+ ;; Find an auto-coding that is specified for the current
;; buffer and file from the region FROM and TO.
(save-excursion
(save-restriction
(unless (and buffer-file-coding-system-explicit
(cdr buffer-file-coding-system-explicit))
- ;; If default-buffer-file-coding-system is not nil nor undecided,
+ ;; If default buffer-file-coding-system is not nil nor undecided,
;; append it to the defaults.
- (if default-buffer-file-coding-system
- (let ((base (coding-system-base default-buffer-file-coding-system)))
- (or (eq base 'undecided)
- (rassq base default-coding-system)
- (setq default-coding-system
- (append default-coding-system
- (list (cons default-buffer-file-coding-system
- base)))))))
+ (when (default-value 'buffer-file-coding-system)
+ (let ((base (coding-system-base
+ (default-value 'buffer-file-coding-system))))
+ (or (eq base 'undecided)
+ (rassq base default-coding-system)
+ (setq default-coding-system
+ (append default-coding-system
+ (list (cons (default-value
+ 'buffer-file-coding-system)
+ base)))))))
;; If the most preferred coding system has the property mime-charset,
;; append it to the defaults.
(setq accept-default-p select-safe-coding-system-accept-default-p))
;; Decide the eol-type from the top of the default codings,
- ;; buffer-file-coding-system, or
- ;; default-buffer-file-coding-system.
+ ;; current buffer-file-coding-system, or default buffer-file-coding-system.
(if default-coding-system
(let ((default-eol-type (coding-system-eol-type
(caar default-coding-system))))
(if (and (vectorp default-eol-type) buffer-file-coding-system)
(setq default-eol-type (coding-system-eol-type
buffer-file-coding-system)))
- (if (and (vectorp default-eol-type) default-buffer-file-coding-system)
- (setq default-eol-type (coding-system-eol-type
- default-buffer-file-coding-system)))
+ (if (and (vectorp default-eol-type)
+ (default-value 'buffer-file-coding-system))
+ (setq default-eol-type
+ (coding-system-eol-type
+ (default-value 'buffer-file-coding-system))))
(if (and default-eol-type (not (vectorp default-eol-type)))
(dolist (elt default-coding-system)
(setcar elt (coding-system-change-eol-conversion
(1) local value of `buffer-file-coding-system'
(2) value of `sendmail-coding-system'
(3) value of `default-sendmail-coding-system'
- (4) value of `default-buffer-file-coding-system'
+ (4) default value of `buffer-file-coding-system'
If the found coding system can't encode the current buffer,
or none of them are bound to a coding system,
it asks the user to select a proper coding system."
buffer-file-coding-system)
sendmail-coding-system
default-sendmail-coding-system
- default-buffer-file-coding-system)))
+ (default-value 'buffer-file-coding-system))))
(if (eq coding 'no-conversion)
;; We should never use no-conversion for outgoing mail.
(setq coding nil))
in extended segments of CTEXT. See the variable
`ctext-non-standard-encodings' for more detail.
-The following keys take effect only when multibyte characters are
-globally disabled, i.e. the value of `default-enable-multibyte-characters'
-is nil.
+The following key takes effect only when multibyte characters are
+globally disabled, i.e. the default value of `enable-multibyte-characters'
+is nil (which is an obsolete and deprecated use):
unibyte-display value is a coding system to encode characters for
the terminal. Characters in the range of 160 to
(set-language-environment-nonascii-translation lang-env))
((eq key 'charset)
(set-language-environment-charset lang-env))
- ((and (not default-enable-multibyte-characters)
+ ((and (not (default-value 'enable-multibyte-characters))
(or (eq key 'unibyte-syntax) (eq key 'unibyte-display)))
(set-language-environment-unibyte lang-env)))))
Each element has the form:
(INPUT-METHOD LANGUAGE-ENV ACTIVATE-FUNC TITLE DESCRIPTION ARGS...)
See the function `register-input-method' for the meanings of the elements.")
+;; Autoload if this file no longer dumped.
+(put 'input-method-alist 'risky-local-variable t)
(defun register-input-method (input-method lang-env &rest args)
"Register INPUT-METHOD as an input method for language environment LANG-ENV.
(setq input-method (symbol-name input-method)))
(help-setup-xref (list #'describe-input-method
(or input-method current-input-method))
- (interactive-p))
+ (called-interactively-p 'interactive))
(if (null input-method)
(describe-current-input-method)
(error
(activate-input-method current)
(help-setup-xref (list #'describe-input-method input-method)
- (interactive-p))
+ (called-interactively-p 'interactive))
(with-output-to-temp-buffer (help-buffer)
(let ((elt (assoc input-method input-method-alist)))
(princ (format
(set-language-environment-nonascii-translation language-name)
(set-language-environment-charset language-name)
;; Unibyte setups if necessary.
- (unless default-enable-multibyte-characters
+ (unless (default-value 'enable-multibyte-characters)
(set-language-environment-unibyte language-name))
(let ((func (get-language-info language-name 'setup-function)))
;; Unibyte Emacs on MS-DOS wants to display all 8-bit characters with
;; the native font, and codes 160 and 146 stand for something very
;; different there.
- (or (and (eq window-system 'pc) (not default-enable-multibyte-characters))
+ (or (and (eq window-system 'pc) (not (default-value
+ 'enable-multibyte-characters)))
(progn
;; Most X fonts used to do the wrong thing for latin-1 code 160.
(unless (and (eq window-system 'x)
"Do various coding system setups for language environment LANGUAGE-NAME."
(let* ((priority (get-language-info language-name 'coding-priority))
(default-coding (car priority))
- ;; If default-buffer-file-coding-system is nil, don't use
+ ;; If the default buffer-file-coding-system is nil, don't use
;; coding-system-eol-type, because it treats nil as
- ;; `no-conversion'. default-buffer-file-coding-system is set
+ ;; `no-conversion'. The default buffer-file-coding-system is set
;; to nil by reset-language-environment, and in that case we
;; want to have here the native EOL type for each platform.
;; FIXME: there should be a common code that runs both on
;; which works only as long as the order of loading files at
;; dump time and calling functions at startup is not modified
;; significantly, i.e. as long as this function is called
- ;; _after_ default-buffer-file-coding-system was set by
+ ;; _after_ the default buffer-file-coding-system was set by
;; dos-w32.el.
(eol-type
- (if (null default-buffer-file-coding-system)
- (cond ((memq system-type '(windows-nt ms-dos)) 1)
- ((eq system-type 'macos) 2)
- (t 0))
- (coding-system-eol-type default-buffer-file-coding-system))))
+ (coding-system-eol-type
+ (or (default-value 'buffer-file-coding-system)
+ (if (memq system-type '(windows-nt ms-dos)) 'dos 'unix)))))
(when priority
(set-default-coding-systems
(if (memq eol-type '(0 1 2 unix dos mac))
(require feature))
(let ((doc (get-language-info language-name 'documentation)))
(help-setup-xref (list #'describe-language-environment language-name)
- (interactive-p))
+ (called-interactively-p 'interactive))
(with-output-to-temp-buffer (help-buffer)
(save-excursion
(set-buffer standard-output)
(charset-language-name
(locale-name-match locale locale-charset-language-names))
(default-eol-type (coding-system-eol-type
- default-buffer-file-coding-system))
+ (default-value 'buffer-file-coding-system)))
(coding-system
(or (locale-name-match locale locale-preferred-coding-systems)
(when locale
(unless frame
(set-language-environment language-name))
- ;; If default-enable-multibyte-characters is nil,
+ ;; If the default enable-multibyte-characters is nil,
;; we are using single-byte characters,
;; so the display table and terminal coding system are irrelevant.
- (when default-enable-multibyte-characters
+ (when (default-value 'enable-multibyte-characters)
(set-display-table-and-terminal-coding-system
language-name coding-system frame))
(and (>= c #x3400 ) (<= c #x4dbf )) ; CJK Ideograph Extension A
(and (>= c #x4e00 ) (<= c #x9fff )) ; CJK Ideograph
(and (>= c #xd800 ) (<= c #xfaff )) ; Private/Surrogate
- (and (>= c #x20000) (<= c #x2ffff)) ; CJK Ideograph Extension B
+ (and (>= c #x1f200) (<= c #x1f2ff)) ; Enclosed Ideographic Supplement
+ (and (>= c #x20000) (<= c #x2ffff)) ; CJK Ideograph Extensions B, C
)
(if (setq name (get-char-code-property c 'name))
(setq names (cons (cons name c) names)))