45 |
With arg, you are asked to choose which language." |
With arg, you are asked to choose which language." |
46 |
(interactive "P") |
(interactive "P") |
47 |
(let ((lang (if arg |
(let ((lang (if arg |
48 |
(progn |
(let (completion-buffer) |
49 |
;; Display a completion list right away |
;; Display a completion list right away |
50 |
;; to guide the user. |
;; to guide the user. |
51 |
(with-output-to-temp-buffer "*Completions*" |
(with-output-to-temp-buffer "*Completions*" |
52 |
(display-completion-list |
(display-completion-list |
53 |
(all-completions "" language-info-alist |
(all-completions "" language-info-alist |
54 |
(lambda (elm) |
(lambda (elm) |
55 |
(and (listp elm) (assq 'tutorial elm)))))) |
(and (listp elm) (assq 'tutorial elm))))) |
56 |
(read-language-name 'tutorial "Language: " "English")) |
(setq completion-buffer standard-output)) |
57 |
|
;; Arrange to set completion-reference-buffer |
58 |
|
;; in *Completions* to point to the minibuffer, |
59 |
|
;; after entering the minibuffer. |
60 |
|
(let ((minibuffer-setup-hook minibuffer-setup-hook)) |
61 |
|
(add-hook 'minibuffer-setup-hook |
62 |
|
(lambda () |
63 |
|
(let ((mini (current-buffer))) |
64 |
|
(with-current-buffer completion-buffer |
65 |
|
(make-local-variable 'completion-reference-buffer) |
66 |
|
(setq completion-reference-buffer |
67 |
|
mini))))) |
68 |
|
(read-language-name 'tutorial "Language: " "English"))) |
69 |
(if (get-language-info current-language-environment 'tutorial) |
(if (get-language-info current-language-environment 'tutorial) |
70 |
current-language-environment |
current-language-environment |
71 |
"English"))) |
"English"))) |