Mercurial > emacs
comparison lisp/help.el @ 20286:5cf064c70ee5
(help-with-tutorial-alist): New variable.
(help-with-tutorial): Use help-with-tutorial-alist to read a language
name, and also to find the tutorial file for a language.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Thu, 20 Nov 1997 21:47:12 +0000 |
parents | e29142cee7c3 |
children | 456ed25a8605 |
comparison
equal
deleted
inserted
replaced
20285:3b0ad3d46bde | 20286:5cf064c70ee5 |
---|---|
135 | 135 |
136 (defun help-quit () | 136 (defun help-quit () |
137 (interactive) | 137 (interactive) |
138 nil) | 138 nil) |
139 | 139 |
140 (defvar help-with-tutorial-alist | |
141 '(("German" . "TUTORIAL.de") | |
142 ("Korean" . "TUTORIAL.kr") | |
143 ("Japanese" . "TUTORIAL.jp") | |
144 ("Thai" . "TUTORIAL.th") | |
145 ("English" . "TUTORIAL")) | |
146 "Alist mapping language names to their translated Emacs tutorial files.") | |
147 | |
140 (defun help-with-tutorial (&optional arg) | 148 (defun help-with-tutorial (&optional arg) |
141 "Select the Emacs learn-by-doing tutorial. | 149 "Select the Emacs learn-by-doing tutorial. |
142 If there is a tutorial version written in the language | 150 If there is a tutorial version written in the language |
143 of the selected language environment, that version is used. | 151 of the selected language environment, that version is used. |
144 If there's no tutorial in that language, `TUTORIAL' is selected. | 152 If there's no tutorial in that language, `TUTORIAL' is selected. |
145 With arg, you are asked to select which language." | 153 With arg, you are asked to choose which language." |
146 (interactive "P") | 154 (interactive "P") |
147 (let (lang filename file) | 155 (let (lang filename file) |
148 (if arg | 156 (if arg |
149 (or (setq lang (read-language-name 'tutorial "Language: ")) | 157 (or (setq lang |
150 (error "No tutorial file of the specified language")) | 158 (let* ((completion-ignore-case t)) |
159 (completing-read "Language: " help-with-tutorial-alist | |
160 nil t))) | |
161 (error "No tutorial file in language")) | |
151 (setq lang current-language-environment)) | 162 (setq lang current-language-environment)) |
152 (setq filename (or (get-language-info lang 'tutorial) | 163 (setq filename (or (cdr (assoc lang help-with-tutorial-alist)) |
153 "TUTORIAL")) | 164 "TUTORIAL")) |
154 (setq file (expand-file-name (concat "~/" filename))) | 165 (setq file (expand-file-name (concat "~/" filename))) |
155 (delete-other-windows) | 166 (delete-other-windows) |
156 (if (get-file-buffer file) | 167 (if (get-file-buffer file) |
157 (switch-to-buffer (get-file-buffer file)) | 168 (switch-to-buffer (get-file-buffer file)) |