;;; mule-cmds.el --- commands for multilingual environment -*-coding: iso-2022-7bit -*-
-;; Copyright (C) 1997-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2012 Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
;; 2005, 2006, 2007, 2008, 2009, 2010, 2011
;; National Institute of Advanced Industrial Science and Technology (AIST)
;;; Code:
-(eval-when-compile (require 'cl)) ; letf
-
(defvar dos-codepage)
(autoload 'widget-value "wid-edit")
"Display the HELLO file, which lists many languages and characters."
(interactive)
;; We have to decode the file in any environment.
- (letf ((coding-system-for-read 'iso-2022-7bit))
+ (let ((coding-system-for-read 'iso-2022-7bit))
(view-file (expand-file-name "HELLO" data-directory))))
(defun universal-coding-system-argument (coding-system)
if CODING-SYSTEM is ASCII-compatible"
(check-coding-system coding-system)
(setq-default buffer-file-coding-system coding-system)
- (if (fboundp 'ucs-set-table-for-input)
- (dolist (buffer (buffer-list))
- (or (local-variable-p 'buffer-file-coding-system buffer)
- (ucs-set-table-for-input buffer))))
(if (eq system-type 'darwin)
;; The file-name coding system on Darwin systems is always utf-8.
(if (memq eol-type '(0 1 2))
(setq base
(coding-system-change-eol-conversion base eol-type)))
- (set-default-coding-systems base)))
+ (set-default-coding-systems base)
+ (if (called-interactively-p 'interactive)
+ (or (eq base default-file-name-coding-system)
+ (message "The default value of `file-name-coding-system' was not changed because the specified coding system is not suitable for file names.")))))
(defvar sort-coding-systems-predicate nil
"If non-nil, a predicate function to sort coding systems.
and try again)? " coding-system auto-cs))
(error "Save aborted"))))
(when (and tick (/= tick (buffer-chars-modified-tick)))
- (error "Cancelled because the buffer was modified"))
+ (error "Canceled because the buffer was modified"))
coding-system)))
(setq select-safe-coding-system-function 'select-safe-coding-system)
(make-variable-buffer-local 'current-input-method-title)
(put 'current-input-method-title 'permanent-local t)
+(define-widget 'mule-input-method-string 'string
+ "String widget with completion for input method."
+ :completions
+ (lambda (string pred action)
+ (let ((completion-ignore-case t))
+ (complete-with-action action input-method-alist string pred)))
+ :prompt-history 'input-method-history)
+
(defcustom default-input-method nil
"Default input method for multilingual text (a string).
This is the input method activated automatically by the command
`toggle-input-method' (\\[toggle-input-method])."
:link '(custom-manual "(emacs)Input Methods")
:group 'mule
- :type '(choice (const nil)
- (string
- :completions (apply-partially
- #'completion-table-case-fold input-method-alist)
- :prompt-history input-method-history))
+ :type `(choice (const nil)
+ mule-input-method-string)
:set-after '(current-language-environment))
(put 'input-method-function 'permanent-local t)
This sets the coding system priority and the default input method
and sometimes other things. LANGUAGE-NAME should be a string
which is the name of a language environment. For example, \"Latin-1\"
-specifies the character set for the major languages of Western Europe."
+specifies the character set for the major languages of Western Europe.
+
+If there is a prior value for `current-language-environment', this
+runs the hook `exit-language-environment-hook'. After setting up
+the new language environment, it runs `set-language-environment-hook'."
(interactive (list (read-language-name
nil
"Set language environment (default English): ")))
(define-widget 'charset 'symbol
"An Emacs charset."
:tag "Charset"
- :completions (apply-partially #'completion-table-with-predicate
- (apply-partially #'completion-table-case-fold
- obarray)
- #'charsetp 'strict)
+ :completions
+ (lambda (string pred action)
+ (let ((completion-ignore-case t))
+ (completion-table-with-predicate
+ obarray #'charsetp 'strict string pred action)))
:value 'ascii
:validate (lambda (widget)
(unless (charsetp (widget-value widget))
:type `(alist
:key-type (string :tag "Language environment"
:completions
- (apply-partially #'completion-table-case-fold
- language-info-alist))
+ (lambda (string pred action)
+ (let ((completion-ignore-case t))
+ (complete-with-action
+ action language-info-alist string pred))))
:value-type
(alist :key-type symbol
:options ((documentation string)
(coding-system (repeat coding-system))
(coding-priority (repeat coding-system))
(nonascii-translation charset)
- (input-method
- (string
- :completions
- (apply-partially #'completion-table-case-fold
- input-method-alist)
- :prompt-history input-method-history))
+ (input-method mule-input-method-string)
(features (repeat symbol))
(unibyte-display coding-system)))))
;; Backwards compatibility. These might be better with :init-value t,
;; but that breaks loadup.
(define-minor-mode unify-8859-on-encoding-mode
- "Obsolete."
+ "Exists only for backwards compatibility."
:group 'mule
:global t)
+;; Doc said "obsolete" in 23.1, this statement only added in 24.1.
+(make-obsolete 'unify-8859-on-encoding-mode "don't use it." "23.1")
+
(define-minor-mode unify-8859-on-decoding-mode
- "Obsolete."
+ "Exists only for backwards compatibility."
:group 'mule
:global t)
+;; Doc said "obsolete" in 23.1, this statement only added in 24.1.
+(make-obsolete 'unify-8859-on-decoding-mode "don't use it." "23.1")
(defvar nonascii-insert-offset 0)
(make-obsolete-variable 'nonascii-insert-offset "do not use it." "23.1")
'(metadata (category . unicode-name))
(complete-with-action action (ucs-names) string pred))))))
(cond
- ((string-match-p "^[0-9a-fA-F]+$" input)
+ ((string-match-p "\\`[0-9a-fA-F]+\\'" input)
(string-to-number input 16))
- ((string-match-p "^#" input)
+ ((string-match-p "\\`#" input)
(read input))
(t
(cdr (assoc-string input (ucs-names) t))))))
the characters whose names include that substring, not necessarily
at the beginning of the name.
+This function also accepts a hexadecimal number of Unicode code
+point or a number in hash notation, e.g. #o21430 for octal,
+#x2318 for hex, or #10r8984 for decimal.
+
The optional third arg INHERIT (non-nil when called interactively),
says to inherit text properties from adjoining text, if those
properties are sticky."
(prefix-numeric-value current-prefix-arg)
t))
(unless count (setq count 1))
- (if (stringp character)
+ (if (and (stringp character)
+ (string-match-p "\\`[0-9a-fA-F]+\\'" character))
(setq character (string-to-number character 16)))
(cond
+ ((null character)
+ (error "Not a Unicode character"))
((not (integerp character))
(error "Not a Unicode character code: %S" character))
((or (< character 0) (> character #x10FFFF))