summaryrefslogtreecommitdiff
path: root/lisp/international/mule-cmds.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/international/mule-cmds.el')
-rw-r--r--lisp/international/mule-cmds.el104
1 files changed, 42 insertions, 62 deletions
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 333fe2aa917..817a26b1feb 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -136,8 +136,7 @@
(expand-file-name "HELLO" data-directory))
:help "Demonstrate various character sets"))
(bindings--define-key map [set-various-coding-system]
- `(menu-item "Set Coding Systems" ,set-coding-system-map
- :enable (default-value 'enable-multibyte-characters)))
+ `(menu-item "Set Coding Systems" ,set-coding-system-map))
(bindings--define-key map [separator-input-method] menu-bar-separator)
(bindings--define-key map [describe-input-method]
@@ -282,9 +281,7 @@ wrong, use this command again to toggle back to the right mode."
(defun view-hello-file ()
"Display the HELLO file, which lists many languages and characters."
(interactive)
- ;; We have to decode the file in any environment.
- (let ((coding-system-for-read 'iso-2022-7bit))
- (view-file (expand-file-name "HELLO" data-directory))))
+ (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."
@@ -303,8 +300,7 @@ wrong, use this command again to toggle back to the right mode."
(cmd (key-binding keyseq))
prefix)
;; read-key-sequence ignores quit, so make an explicit check.
- ;; Like many places, this assumes quit == C-g, but it need not be.
- (if (equal last-input-event ?\C-g)
+ (if (equal last-input-event (nth 3 (current-input-mode)))
(keyboard-quit))
(when (memq cmd '(universal-argument digit-argument))
(call-interactively cmd)
@@ -317,16 +313,16 @@ wrong, use this command again to toggle back to the right mode."
(let ((current-prefix-arg prefix-arg)
;; Have to bind `last-command-event' here so that
;; `digit-argument', for instance, can compute the
- ;; prefix arg.
+ ;; `prefix-arg'.
(last-command-event (aref keyseq 0)))
(call-interactively cmd)))
;; This is the final call to `universal-argument-other-key', which
- ;; set's the final `prefix-arg.
+ ;; sets the final `prefix-arg'.
(let ((current-prefix-arg prefix-arg))
(call-interactively cmd))
- ;; Read the command to execute with the given prefix arg.
+ ;; Read the command to execute with the given `prefix-arg'.
(setq prefix prefix-arg
keyseq (read-key-sequence nil t)
cmd (key-binding keyseq)))
@@ -355,8 +351,7 @@ This also sets the following values:
(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-unix)
- (if (and (default-value 'enable-multibyte-characters)
- (or (not coding-system)
+ (if (and (or (not coding-system)
(coding-system-get coding-system 'ascii-compatible-p)))
(setq default-file-name-coding-system
(coding-system-change-eol-conversion coding-system 'unix))))
@@ -456,8 +451,8 @@ non-nil, it is used to sort CODINGS instead."
;; E: 1 if not XXX-with-esc
;; II: if iso-2022 based, 0..3, else 1.
(logior
- (lsh (if (eq base most-preferred) 1 0) 7)
- (lsh
+ (ash (if (eq base most-preferred) 1 0) 7)
+ (ash
(let ((mime (coding-system-get base :mime-charset)))
;; Prefer coding systems corresponding to a
;; MIME charset.
@@ -473,9 +468,9 @@ non-nil, it is used to sort CODINGS instead."
(t 3))
0))
5)
- (lsh (if (memq base lang-preferred) 1 0) 4)
- (lsh (if (memq base from-priority) 1 0) 3)
- (lsh (if (string-match-p "-with-esc\\'"
+ (ash (if (memq base lang-preferred) 1 0) 4)
+ (ash (if (memq base from-priority) 1 0) 3)
+ (ash (if (string-match-p "-with-esc\\'"
(symbol-name base))
0 1) 2)
(if (eq (coding-system-type base) 'iso-2022)
@@ -992,6 +987,11 @@ It is highly recommended to fix it before writing to a file."
;; If all the defaults failed, ask a user.
(when (not coding-system)
+ ;; If UTF-8 is in CODINGS, but is not its first member, make
+ ;; it the first one, so it is offered as the default.
+ (and (memq 'utf-8 codings) (not (eq 'utf-8 (car codings)))
+ (setq codings (append '(utf-8) (delq 'utf-8 codings))))
+
(setq coding-system (select-safe-coding-system-interactively
from to codings unsafe rejected (car codings))))
@@ -1158,10 +1158,7 @@ see `language-info-alist'."
((eq key 'nonascii-translation)
(set-language-environment-nonascii-translation lang-env))
((eq key 'charset)
- (set-language-environment-charset lang-env))
- ((and (not (default-value 'enable-multibyte-characters))
- (or (eq key 'unibyte-syntax) (eq key 'unibyte-display)))
- (set-language-environment-unibyte lang-env)))))
+ (set-language-environment-charset lang-env)))))
(defun set-language-info-internal (lang-env key info)
"Internal use only.
@@ -1471,12 +1468,7 @@ If INPUT-METHOD is nil, deactivate any current input method."
(defun deactivate-input-method ()
"Turn off the current input method."
(when current-input-method
- (if input-method-history
- (unless (string= current-input-method (car input-method-history))
- (setq input-method-history
- (cons current-input-method
- (delete current-input-method input-method-history))))
- (setq input-method-history (list current-input-method)))
+ (add-to-history 'input-method-history current-input-method)
(unwind-protect
(progn
(setq input-method-function nil
@@ -1800,6 +1792,9 @@ The default status is as follows:
(setq default-sendmail-coding-system 'iso-latin-1)
;; On Darwin systems, this should be utf-8-unix, but when this file is loaded
;; that is not yet defined, so we set it in set-locale-environment instead.
+ ;; [Actually, it seems to work fine to use utf-8-unix here, and not just
+ ;; on Darwin. The previous comment seems to be outdated?
+ ;; See patch at https://debbugs.gnu.org/15803 ]
(setq default-file-name-coding-system 'iso-latin-1-unix)
;; Preserve eol-type from existing default-process-coding-systems.
;; On non-unix-like systems in particular, these may have been set
@@ -1897,9 +1892,6 @@ the new language environment, it runs `set-language-environment-hook'."
(set-language-environment-input-method language-name)
(set-language-environment-nonascii-translation language-name)
(set-language-environment-charset language-name)
- ;; Unibyte setups if necessary.
- (unless (default-value 'enable-multibyte-characters)
- (set-language-environment-unibyte language-name))
(let ((func (get-language-info language-name 'setup-function)))
(if (functionp func)
@@ -1978,28 +1970,22 @@ See `set-language-info-alist' for use in programs."
(defun standard-display-european-internal ()
;; Actually set up direct output of non-ASCII characters.
(standard-display-8bit (if (eq window-system 'pc) 128 160) 255)
- ;; 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-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)
- ;; XFree86 4 has fixed the fonts.
- (string= "The XFree86 Project, Inc" (x-server-vendor))
- (> (aref (number-to-string (nth 2 (x-server-version))) 0)
- ?3))
- ;; Make non-line-break space display as a plain space.
- (aset standard-display-table (unibyte-char-to-multibyte 160) [32]))
- ;; Most Windows programs send out apostrophes as \222. Most X fonts
- ;; don't contain a character at that position. Map it to the ASCII
- ;; apostrophe. [This is actually RIGHT SINGLE QUOTATION MARK,
- ;; U+2019, normally from the windows-1252 character set. XFree 4
- ;; fonts probably have the appropriate glyph at this position,
- ;; so they could use standard-display-8bit. It's better to use a
- ;; proper windows-1252 coding system. --fx]
- (aset standard-display-table (unibyte-char-to-multibyte 146) [39]))))
+ ;; Most X fonts used to do the wrong thing for latin-1 code 160.
+ (unless (and (eq window-system 'x)
+ ;; XFree86 4 has fixed the fonts.
+ (string= "The XFree86 Project, Inc" (x-server-vendor))
+ (> (aref (number-to-string (nth 2 (x-server-version))) 0)
+ ?3))
+ ;; Make non-line-break space display as a plain space.
+ (aset standard-display-table (unibyte-char-to-multibyte 160) [32]))
+ ;; Most Windows programs send out apostrophes as \222. Most X fonts
+ ;; don't contain a character at that position. Map it to the ASCII
+ ;; apostrophe. [This is actually RIGHT SINGLE QUOTATION MARK,
+ ;; U+2019, normally from the windows-1252 character set. XFree 4
+ ;; fonts probably have the appropriate glyph at this position,
+ ;; so they could use standard-display-8bit. It's better to use a
+ ;; proper windows-1252 coding system. --fx]
+ (aset standard-display-table (unibyte-char-to-multibyte 146) [39]))
(defun set-language-environment-coding-systems (language-name)
"Do various coding system setups for language environment LANGUAGE-NAME."
@@ -2035,10 +2021,8 @@ See `set-language-info-alist' for use in programs."
(let ((input-method (get-language-info language-name 'input-method)))
(when input-method
(setq default-input-method input-method)
- (if input-method-history
- (setq input-method-history
- (cons input-method
- (delete input-method input-method-history)))))))
+ (when input-method-history
+ (add-to-history 'input-method-history input-method)))))
(defun set-language-environment-nonascii-translation (language-name)
"Do unibyte/multibyte translation setup for language environment LANGUAGE-NAME."
@@ -2665,12 +2649,8 @@ See also `locale-charset-language-names', `locale-language-names',
(unless frame
(set-language-environment language-name))
- ;; 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-value 'enable-multibyte-characters)
- (set-display-table-and-terminal-coding-system
- language-name coding-system frame))
+ (set-display-table-and-terminal-coding-system
+ language-name coding-system frame)
;; Set the `keyboard-coding-system' if appropriate (tty
;; only). At least X and MS Windows can generate