Commit f850d782 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(set-language-environment): Do the real work here.

(current-language-environment): New variable.
(setup-specified-language-environment): Call set-language-environment.
Set current-language-environment.
(describe-language-environment):
By default, use current-language-environment.
parent ac4a3a2d
...@@ -522,30 +522,33 @@ inputting at minibuffer if this flag is t.") ...@@ -522,30 +522,33 @@ inputting at minibuffer if this flag is t.")
(defun setup-specified-language-environment () (defun setup-specified-language-environment ()
"Setup multi-lingual environment convenient for the specified language." "Set up multi-lingual environment convenient for the specified language."
(interactive) (interactive)
(let (language-name func) (let (language-name)
(if (and (symbolp last-command-event) (if (and (symbolp last-command-event)
(or (not (eq last-command-event 'Default)) (or (not (eq last-command-event 'Default))
(setq last-command-event 'English)) (setq last-command-event 'English))
(setq language-name (symbol-name last-command-event)) (setq language-name (symbol-name last-command-event)))
(setq func (get-language-info language-name 'setup-function))) (set-language-environment language-name)
(progn
(funcall func)
(force-mode-line-update t))
(error "Bogus calling sequence")))) (error "Bogus calling sequence"))))
(defvar current-language-environment "English"
"The last language environment specified with `set-language-environment'.")
;;;###autoload ;;;###autoload
(defun set-language-environment (language-name) (defun set-language-environment (language-name)
"Set up multi-lingual environment for using LANGUAGE-NAME. "Set up multi-lingual environment for using LANGUAGE-NAME.
This sets the coding system priority and the default input method This sets the coding system priority and the default input method
and sometimes other things." and sometimes other things."
(interactive (list (read-language-name 'setup-function "Language: "))) (interactive (list (read-language-name 'setup-function "Language: ")))
(if (member (downcase language-name) '("default"))
(setq language-name "english"))
(if (or (null language-name) (if (or (null language-name)
(null (get-language-info language-name 'setup-function))) (null (get-language-info language-name 'setup-function)))
(error "No way to setup environment for the specified language")) (error "Language environment not defined: %S" language-name))
(let ((last-command-event (intern language-name))) (funcall (get-language-info language-name 'setup-function))
(setup-specified-language-environment))) (setq current-language-environment language-name)
(force-mode-line-update t))
;; Print all arguments with `princ', then print "\n". ;; Print all arguments with `princ', then print "\n".
(defsubst princ-list (&rest args) (defsubst princ-list (&rest args)
...@@ -569,6 +572,8 @@ and sometimes other things." ...@@ -569,6 +572,8 @@ and sometimes other things."
(defun describe-language-environment (language-name) (defun describe-language-environment (language-name)
"Describe how Emacs supports language environment LANGUAGE-NAME." "Describe how Emacs supports language environment LANGUAGE-NAME."
(interactive (list (read-language-name 'documentation "Language: "))) (interactive (list (read-language-name 'documentation "Language: ")))
(if (null language-name)
(setq language-name current-language-environment))
(if (or (null language-name) (if (or (null language-name)
(null (get-language-info language-name 'documentation))) (null (get-language-info language-name 'documentation)))
(error "No documentation for the specified language")) (error "No documentation for the specified language"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment