Mercurial > emacs
annotate lisp/tutorial.el @ 73575:c39e3aff703e
(mac_create_bitmap_from_bitmap_data): Make variable
`swap_nibbles' static const.
(atsu_get_text_layout_with_text_ptr): Make variables `lengths',
`tags', `sizes', `values' static const.
(mac_draw_string_common): Make variables `context' static. Make
variables `tags', `sizes', and `values' static const.
(pcm_get_status, x_detect_focus_change, x_scroll_bar_handle_click)
(xlfdpat_create, xlfdpat_block_match_1, xlfdpat_match)
(mac_to_x_fontname, parse_x_font_name, add_mac_font_name)
(mac_do_list_fonts, is_fully_specified_xlfd, do_grow_window)
(mac_store_event_ref_as_apple_event, mac_make_rdb): Add const
qualifier to arguments.
(xlfd_scalable_fields, keycode_to_xkeysym_table)
(fn_keycode_to_keycode_table): Make static const.
(mac_load_query_font): Make variables `tags', `sizes', `values',
`types', and `selectors' static const.
(mac_handle_command_event, mac_handle_window_event): Make
variables `names' and `types' static const.
(init_command_handler, install_window_handler): Make variables
`specs*' static const.
(mac_handle_font_event, mac_handle_text_input_event)
(mac_store_service_event): Make variables `names' and `types'
const. Make variables `names_*' and `types_*' static const.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Tue, 31 Oct 2006 08:32:56 +0000 |
parents | 14e412e445c1 |
children | 9b8e3f194cc1 |
rev | line source |
---|---|
73550
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; tutorial.el --- tutorial for Emacs |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
3 ;; Copyright (C) 2006 Free Software Foundation, Inc. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 ;; Maintainer: FSF |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Keywords: help, internal |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 ;; GNU Emacs is free software; you can redistribute it and/or modify |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; any later version. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; GNU Emacs is distributed in the hope that it will be useful, |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; GNU General Public License for more details. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;; Boston, MA 02110-1301, USA. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;;; Commentary: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; Code for running the Emacs tutorial. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;;; History: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 ;; File was created 2006-09. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 ;;; Code: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 (require 'help-mode) ;; for function help-buffer |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 (eval-when-compile (require 'cl)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 |
73551
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
38 (defvar tutorial--point-before-chkeys 0 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
39 "Point before display of key changes.") |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
40 (make-variable-buffer-local 'tutorial--point-before-chkeys) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
41 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
42 (defvar tutorial--point-after-chkeys 0 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
43 "Point after display of key changes.") |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
44 (make-variable-buffer-local 'tutorial--point-after-chkeys) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
45 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
46 (defvar tutorial--lang nil |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
47 "Tutorial language.") |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
48 (make-variable-buffer-local 'tutorial--lang) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
49 |
73552 | 50 (defun tutorial--describe-nonstandard-key (value) |
51 "Give more information about a changed key binding. | |
52 This is used in `help-with-tutorial'. The information includes | |
53 the key sequence that no longer has a default binding, the | |
54 default binding and the current binding. It also tells in what | |
55 keymap the new binding has been done and how to access the | |
56 function in the default binding from the keyboard. | |
57 | |
58 For `cua-mode' key bindings that try to combine CUA key bindings | |
59 with default Emacs bindings information about this is shown. | |
60 | |
61 VALUE should have either of these formats: | |
62 | |
63 \(cua-mode) | |
64 \(current-binding KEY-FUN DEF-FUN KEY WHERE) | |
65 | |
66 Where | |
67 KEY is a key sequence whose standard binding has been changed | |
68 KEY-FUN is the actual binding for KEY | |
69 DEF-FUN is the standard binding of KEY | |
70 WHERE is a text describing the key sequences to which DEF-FUN is | |
71 bound now (or, if it is remapped, a key sequence | |
72 for the function it is remapped to)" | |
73 (with-output-to-temp-buffer (help-buffer) | |
74 (help-setup-xref (list #'tutorial--describe-nonstandard-key value) | |
75 (interactive-p)) | |
76 (with-current-buffer (help-buffer) | |
77 (insert | |
78 "Your Emacs customizations override the default binding for this key:" | |
79 "\n\n") | |
80 (let ((inhibit-read-only t)) | |
81 (cond | |
82 ((eq (car value) 'cua-mode) | |
83 (insert | |
84 "CUA mode is enabled. | |
85 | |
86 When CUA mode is enabled, you can use C-z, C-x, C-c, and C-v to | |
87 undo, cut, copy, and paste in addition to the normal Emacs | |
88 bindings. The C-x and C-c keys only do cut and copy when the | |
89 region is active, so in most cases, they do not conflict with the | |
90 normal function of these prefix keys. | |
91 | |
92 If you really need to perform a command which starts with one of | |
93 the prefix keys even when the region is active, you have three | |
94 options: | |
95 - press the prefix key twice very quickly (within 0.2 seconds), | |
96 - press the prefix key and the following key within 0.2 seconds, or | |
97 - use the SHIFT key with the prefix key, i.e. C-S-x or C-S-c.")) | |
98 ((eq (car value) 'current-binding) | |
99 (let ((cb (nth 1 value)) | |
100 (db (nth 2 value)) | |
101 (key (nth 3 value)) | |
102 (where (nth 4 value)) | |
103 map | |
104 (maps (current-active-maps)) | |
105 mapsym) | |
106 ;; Look at the currently active keymaps and try to find | |
107 ;; first the keymap where the current binding occurs: | |
108 (while maps | |
109 (let* ((m (car maps)) | |
110 (mb (lookup-key m key t))) | |
111 (setq maps (cdr maps)) | |
112 (when (eq mb cb) | |
113 (setq map m) | |
114 (setq maps nil)))) | |
115 ;; Now, if a keymap was found we must found the symbol | |
116 ;; name for it to display to the user. This can not | |
117 ;; always be found since all keymaps does not have a | |
118 ;; symbol pointing to them, but here they should have | |
119 ;; that: | |
120 (when map | |
121 (mapatoms (lambda (s) | |
122 (and | |
123 ;; If not already found | |
124 (not mapsym) | |
125 ;; and if s is a keymap | |
126 (and (boundp s) | |
127 (keymapp (symbol-value s))) | |
128 ;; and not the local symbol map | |
129 (not (eq s 'map)) | |
130 ;; and the value of s is map | |
131 (eq map (symbol-value s)) | |
132 ;; then save this value in mapsym | |
133 (setq mapsym s))))) | |
134 (insert "The default Emacs binding for the key " | |
135 (key-description key) | |
136 " is the command `") | |
137 (insert (format "%s" db)) | |
138 (insert "'. " | |
139 "However, your customizations have rebound it to the command `") | |
140 (insert (format "%s" cb)) | |
141 (insert "'.") | |
142 (when mapsym | |
143 (insert " (For the more advanced user:" | |
144 " This binding is in the keymap `" | |
145 (format "%s" mapsym) | |
146 "'.)")) | |
147 (if (string= where "") | |
148 (unless (keymapp db) | |
149 (insert "\n\nYou can use M-x " | |
150 (format "%s" db) | |
151 " RET instead.")) | |
152 (insert "\n\nWith you current key bindings" | |
153 " you can use the key " | |
154 where | |
155 " to get the function `" | |
156 (format "%s" db) | |
157 "'.")) | |
158 ) | |
159 (fill-region (point-min) (point))))) | |
160 (print-help-return-message)))) | |
161 | |
162 (defun tutorial--sort-keys (left right) | |
163 "Sort predicate for use with `tutorial--default-keys'. | |
164 This is a predicate function to `sort'. | |
165 | |
166 The sorting is for presentation purpose only and is done on the | |
167 key sequence. | |
168 | |
169 LEFT and RIGHT are the elements to compare." | |
170 (let ((x (append (cadr left) nil)) | |
171 (y (append (cadr right) nil))) | |
172 ;; Skip the front part of the key sequences if they are equal: | |
173 (while (and x y | |
174 (listp x) (listp y) | |
175 (equal (car x) (car y))) | |
176 (setq x (cdr x)) | |
177 (setq y (cdr y))) | |
178 ;; Try to make a comparision that is useful for presentation (this | |
179 ;; could be made nicer perhaps): | |
180 (let ((cx (car x)) | |
181 (cy (car y))) | |
182 ;;(message "x=%s, y=%s;;;; cx=%s, cy=%s" x y cx cy) | |
183 (cond | |
184 ;; Lists? Then call this again | |
185 ((and cx cy | |
186 (listp cx) | |
187 (listp cy)) | |
188 (tutorial--sort-keys cx cy)) | |
189 ;; Are both numbers? Then just compare them | |
190 ((and (wholenump cx) | |
191 (wholenump cy)) | |
192 (> cx cy)) | |
193 ;; Is one of them a number? Let that be bigger then. | |
194 ((wholenump cx) | |
195 t) | |
196 ((wholenump cy) | |
197 nil) | |
198 ;; Are both symbols? Compare the names then. | |
199 ((and (symbolp cx) | |
200 (symbolp cy)) | |
201 (string< (symbol-name cy) | |
202 (symbol-name cx))) | |
203 )))) | |
204 | |
73551
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
205 (defconst tutorial--default-keys |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
206 (let* ( |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
207 ;; On window system suspend Emacs is replaced in the |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
208 ;; default keymap so honor this here. |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
209 (suspend-emacs (if window-system |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
210 'iconify-or-deiconify-frame |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
211 'suspend-emacs)) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
212 (default-keys |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
213 `( |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
214 ;; These are not mentioned but are basic: |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
215 (ESC-prefix [27]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
216 (Control-X-prefix [?\C-x]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
217 (mode-specific-command-prefix [?\C-c]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
218 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
219 (save-buffers-kill-emacs [?\C-x ?\C-c]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
220 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
221 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
222 ;; * SUMMARY |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
223 (scroll-up [?\C-v]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
224 (scroll-down [?\M-v]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
225 (recenter [?\C-l]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
226 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
227 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
228 ;; * BASIC CURSOR CONTROL |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
229 (forward-char [?\C-f]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
230 (backward-char [?\C-b]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
231 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
232 (forward-word [?\M-f]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
233 (backward-word [?\M-b]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
234 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
235 (next-line [?\C-n]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
236 (previous-line [?\C-p]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
237 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
238 (move-beginning-of-line [?\C-a]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
239 (move-end-of-line [?\C-e]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
240 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
241 (backward-sentence [?\M-a]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
242 (forward-sentence [?\M-e]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
243 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
244 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
245 (beginning-of-buffer [?\M-<]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
246 (end-of-buffer [?\M->]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
247 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
248 (universal-argument [?\C-u]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
249 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
250 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
251 ;; * WHEN EMACS IS HUNG |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
252 (keyboard-quit [?\C-g]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
253 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
254 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
255 ;; * DISABLED COMMANDS |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
256 (downcase-region [?\C-x ?\C-l]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
257 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
258 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
259 ;; * WINDOWS |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
260 (delete-other-windows [?\C-x ?1]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
261 ;; C-u 0 C-l |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
262 ;; Type CONTROL-h k CONTROL-f. |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
263 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
264 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
265 ;; * INSERTING AND DELETING |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
266 ;; C-u 8 * to insert ********. |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
267 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
268 (delete-backward-char [backspace]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
269 (delete-char [?\C-d]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
270 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
271 (backward-kill-word [(meta backspace)]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
272 (kill-word [?\M-d]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
273 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
274 (kill-line [?\C-k]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
275 (kill-sentence [?\M-k]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
276 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
277 (set-mark-command [?\C-@]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
278 (set-mark-command [?\C- ]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
279 (kill-region [?\C-w]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
280 (yank [?\C-y]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
281 (yank-pop [?\M-y]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
282 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
283 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
284 ;; * UNDO |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
285 (advertised-undo [?\C-x ?u]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
286 (advertised-undo [?\C-x ?u]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
287 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
288 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
289 ;; * FILES |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
290 (find-file [?\C-x ?\C-f]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
291 (save-buffer [?\C-x ?\C-s]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
292 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
293 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
294 ;; * BUFFERS |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
295 (list-buffers [?\C-x ?\C-b]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
296 (switch-to-buffer [?\C-x ?b]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
297 (save-some-buffers [?\C-x ?s]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
298 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
299 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
300 ;; * EXTENDING THE COMMAND SET |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
301 ;; C-x Character eXtend. Followed by one character. |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
302 (execute-extended-command [?\M-x]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
303 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
304 ;; C-x C-f Find file |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
305 ;; C-x C-s Save file |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
306 ;; C-x s Save some buffers |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
307 ;; C-x C-b List buffers |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
308 ;; C-x b Switch buffer |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
309 ;; C-x C-c Quit Emacs |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
310 ;; C-x 1 Delete all but one window |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
311 ;; C-x u Undo |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
312 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
313 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
314 ;; * MODE LINE |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
315 (describe-mode [?\C-h ?m]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
316 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
317 (set-fill-column [?\C-x ?f]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
318 (fill-paragraph [?\M-q]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
319 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
320 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
321 ;; * SEARCHING |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
322 (isearch-forward [?\C-s]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
323 (isearch-backward [?\C-r]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
324 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
325 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
326 ;; * MULTIPLE WINDOWS |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
327 (split-window-vertically [?\C-x ?2]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
328 (scroll-other-window [?\C-\M-v]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
329 (other-window [?\C-x ?o]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
330 (find-file-other-window [?\C-x ?4 ?\C-f]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
331 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
332 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
333 ;; * RECURSIVE EDITING LEVELS |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
334 (keyboard-escape-quit [27 27 27]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
335 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
336 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
337 ;; * GETTING MORE HELP |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
338 ;; The most basic HELP feature is C-h c |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
339 (describe-key-briefly [?\C-h ?c]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
340 (describe-key [?\C-h ?k]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
341 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
342 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
343 ;; * MORE FEATURES |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
344 ;; F10 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
345 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
346 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
347 ;; * CONCLUSION |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
348 ;;(iconify-or-deiconify-frame [?\C-z]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
349 (,suspend-emacs [?\C-z]) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
350 ))) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
351 (sort default-keys 'tutorial--sort-keys)) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
352 "Default Emacs key bindings that the tutorial depends on.") |
73550
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 (defun tutorial--detailed-help (button) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 "Give detailed help about changed keys." |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 (with-output-to-temp-buffer (help-buffer) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 (help-setup-xref (list #'tutorial--detailed-help button) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 (interactive-p)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 (with-current-buffer (help-buffer) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 (let* ((tutorial-buffer (button-get button 'tutorial-buffer)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 ;;(tutorial-arg (button-get button 'tutorial-arg)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 (explain-key-desc (button-get button 'explain-key-desc)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 (changed-keys (with-current-buffer tutorial-buffer |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 (tutorial--find-changed-keys tutorial--default-keys)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 (when changed-keys |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 (insert |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 "The following key bindings used in the tutorial had been changed |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 from Emacs default in the " (buffer-name tutorial-buffer) " buffer:\n\n" ) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 (let ((frm " %-9s %-27s %-11s %s\n")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 (insert (format frm "Key" "Standard Binding" "Is Now On" "Remark"))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 (dolist (tk changed-keys) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 (let* ((def-fun (nth 1 tk)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 (key (nth 0 tk)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 (def-fun-txt (nth 2 tk)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 (where (nth 3 tk)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 (remark (nth 4 tk)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 (rem-fun (command-remapping def-fun)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 (key-txt (key-description key)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 (key-fun (with-current-buffer tutorial-buffer (key-binding key))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 tot-len) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 (unless (eq def-fun key-fun) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 ;; Insert key binding description: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 (when (string= key-txt explain-key-desc) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 (put-text-property 0 (length key-txt) 'face '(:background "yellow") key-txt)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 (insert " " key-txt " ") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
386 (setq tot-len (length key-txt)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 (when (> 9 tot-len) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 (insert (make-string (- 9 tot-len) ? )) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 (setq tot-len 9)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 ;; Insert a link describing the old binding: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 (insert-button def-fun-txt |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 'value def-fun |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 'action |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
394 (lambda(button) (interactive) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
395 (describe-function |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
396 (button-get button 'value))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
397 'follow-link t) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
398 (setq tot-len (+ tot-len (length def-fun-txt))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
399 (when (> 36 tot-len) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
400 (insert (make-string (- 36 tot-len) ? ))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
401 (when (listp where) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
402 (setq where "list")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
403 ;; Tell where the old binding is now: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
404 (insert (format " %-11s " where)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
405 ;; Insert a link with more information, for example |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
406 ;; current binding and keymap or information about |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
407 ;; cua-mode replacements: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
408 (insert-button (car remark) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
409 'action |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
410 (lambda(b) (interactive) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
411 (let ((value (button-get b 'value))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
412 (tutorial--describe-nonstandard-key value))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
413 'value (cdr remark) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
414 'follow-link t) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
415 (insert "\n"))))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
416 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
417 (insert " |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
418 It is legitimate to change key bindings, but changed bindings do not |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
419 correspond to what the tutorial says. (See also " ) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
420 (insert-button "Key Binding Conventions" |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
421 'action |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
422 (lambda(button) (interactive) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
423 (info |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
424 "(elisp) Key Binding Conventions") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
425 (message "Type C-x 0 to close the new window")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
426 'follow-link t) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
427 (insert ".)\n\n") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
428 (print-help-return-message))))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
429 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
430 (defun tutorial--find-changed-keys (default-keys) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
431 "Find the key bindings that have changed. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
432 Check if the default Emacs key bindings that the tutorial depends |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
433 on have been changed. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
434 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
435 Return a list with the keys that have been changed. The element |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
436 of this list have the following format: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
437 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
438 \(list KEY DEF-FUN DEF-FUN-TXT WHERE REMARK) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
439 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
440 Where |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
441 KEY is a key sequence whose standard binding has been changed |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
442 DEF-FUN is the standard binding of KEY |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
443 DEF-FUN-TXT is a short descriptive text for DEF-FUN |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
444 WHERE is a text describing the key sequences to which DEF-FUN is |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
445 bound now (or, if it is remapped, a key sequence |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
446 for the function it is remapped to) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
447 REMARK is a list with info about rebinding. It has either of these |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
448 formats: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
449 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
450 \(TEXT cua-mode) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
451 \(TEXT current-binding KEY-FUN DEF-FUN KEY WHERE) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
452 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
453 Here TEXT is a link text to show to the user. The |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
454 rest of the list is used to show information when |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
455 the user clicks the link. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
456 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
457 KEY-FUN is the actual binding for KEY." |
73551
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
458 (let (changed-keys remark) |
73550
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
459 ;; (default-keys tutorial--default-keys)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
460 (dolist (kdf default-keys) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
461 ;; The variables below corresponds to those with the same names |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
462 ;; described in the doc string. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
463 (let* ((key (nth 1 kdf)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
464 (def-fun (nth 0 kdf)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
465 (def-fun-txt (format "%s" def-fun)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
466 (rem-fun (command-remapping def-fun)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
467 (key-fun (key-binding key)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
468 (where (where-is-internal (if rem-fun rem-fun def-fun)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
469 (when (eq key-fun 'ESC-prefix) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
470 (message "ESC-prefix!!!!")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
471 (if where |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
472 (progn |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
473 (setq where (key-description (car where))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
474 (when (and (< 10 (length where)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
475 (string= (substring where 0 (length "<menu-bar>")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
476 "<menu-bar>")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
477 (setq where "The menus"))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
478 (setq where "")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
479 (setq remark nil) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
480 (unless |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
481 (cond ((eq key-fun def-fun) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
482 ;; No rebinding, return t |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
483 t) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
484 ((eq key-fun (command-remapping def-fun)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
485 ;; Just a remapping, return t |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
486 t) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
487 ;; cua-mode specials: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
488 ((and cua-mode |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
489 (or (and |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
490 (equal key [?\C-v]) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
491 (eq key-fun 'cua-paste)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
492 (and |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
493 (equal key [?\C-z]) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
494 (eq key-fun 'undo)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
495 (setq remark (list "cua-mode, more info" 'cua-mode)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
496 nil) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
497 ((and cua-mode |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
498 (or |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
499 (and (eq def-fun 'ESC-prefix) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
500 (equal key-fun |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
501 `(keymap |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
502 (118 . cua-repeat-replace-region)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
503 (and (eq def-fun 'mode-specific-command-prefix) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
504 (equal key-fun |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
505 '(keymap |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
506 (timeout . copy-region-as-kill)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
507 (and (eq def-fun 'Control-X-prefix) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
508 (equal key-fun |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
509 '(keymap (timeout . kill-region)))))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
510 (setq remark (list "cua-mode replacement" 'cua-mode)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
511 (cond |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
512 ((eq def-fun 'mode-specific-command-prefix) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
513 (setq def-fun-txt "\"C-c prefix\"")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
514 ((eq def-fun 'Control-X-prefix) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
515 (setq def-fun-txt "\"C-x prefix\"")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
516 ((eq def-fun 'ESC-prefix) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
517 (setq def-fun-txt "\"ESC prefix\""))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
518 (setq where "Same key") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
519 nil) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
520 ;; viper-mode specials: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
521 ((and (boundp 'viper-mode-string) |
73551
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
522 (boundp 'viper-current-state) |
73550
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
523 (eq viper-current-state 'vi-state) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
524 (or (and (eq def-fun 'isearch-forward) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
525 (eq key-fun 'viper-isearch-forward)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
526 (and (eq def-fun 'isearch-backward) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
527 (eq key-fun 'viper-isearch-backward)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
528 ;; These bindings works as the default bindings, |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
529 ;; return t |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
530 t) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
531 ((when normal-erase-is-backspace |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
532 (or (and (equal key [C-delete]) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
533 (equal key-fun 'kill-word)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
534 (and (equal key [C-backspace]) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
535 (equal key-fun 'backward-kill-word)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
536 ;; This is the strange handling of C-delete and |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
537 ;; C-backspace, return t |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
538 t) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
539 (t |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
540 ;; This key has indeed been rebound. Put information |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
541 ;; in `remark' and return nil |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
542 (setq remark |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
543 (list "more info" 'current-binding |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
544 key-fun def-fun key where)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
545 nil)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
546 (add-to-list 'changed-keys |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
547 (list key def-fun def-fun-txt where remark))))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
548 changed-keys)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
549 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
550 (defvar tutorial--tab-map |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
551 (let ((map (make-sparse-keymap))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
552 (define-key map [tab] 'forward-button) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
553 (define-key map [(shift tab)] 'backward-button) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
554 (define-key map [(meta tab)] 'backward-button) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
555 map) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
556 "Keymap that allows tabbing between buttons.") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
557 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
558 (defun tutorial--display-changes (changed-keys) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
559 "Display changes to some default key bindings. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
560 If some of the default key bindings that the tutorial depends on |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
561 have been changed then display the changes in the tutorial buffer |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
562 with some explanatory links. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
563 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
564 CHANGED-KEYS should be a list in the format returned by |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
565 `tutorial--find-changed-keys'." |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
566 (when (or changed-keys |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
567 (boundp 'viper-mode-string)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
568 ;; Need the custom button face for viper buttons: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
569 (when (boundp 'viper-mode-string) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
570 (require 'cus-edit)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
571 (let ((start (point)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
572 end |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
573 (head (get-lang-string tutorial--lang 'tut-chgdhead)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
574 (head2 (get-lang-string tutorial--lang 'tut-chgdhead2))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
575 (when (and head head2) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
576 (goto-char tutorial--point-before-chkeys) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
577 (insert head) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
578 (insert-button head2 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
579 'tutorial-buffer |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
580 (current-buffer) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
581 ;;'tutorial-arg arg |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
582 'action |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
583 'tutorial--detailed-help |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
584 'follow-link t |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
585 'face '(:inherit link :background "yellow")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
586 (insert "]\n\n" ) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
587 (when changed-keys |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
588 (dolist (tk changed-keys) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
589 (let* ((def-fun (nth 1 tk)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
590 (key (nth 0 tk)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
591 (def-fun-txt (nth 2 tk)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
592 (where (nth 3 tk)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
593 (remark (nth 4 tk)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
594 (rem-fun (command-remapping def-fun)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
595 (key-txt (key-description key)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
596 (key-fun (key-binding key)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
597 tot-len) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
598 (unless (eq def-fun key-fun) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
599 ;; Mark the key in the tutorial text |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
600 (unless (string= "Same key" where) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
601 (let ((here (point)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
602 (key-desc (key-description key))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
603 (while (search-forward key-desc nil t) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
604 (put-text-property (match-beginning 0) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
605 (match-end 0) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
606 'tutorial-remark 'only-colored) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
607 (put-text-property (match-beginning 0) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
608 (match-end 0) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
609 'face '(:background "yellow")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
610 (forward-line) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
611 (let ((s (get-lang-string tutorial--lang 'tut-chgdkey)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
612 (s2 (get-lang-string tutorial--lang 'tut-chgdkey2)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
613 (start (point)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
614 end) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
615 ;;(concat "** The key " key-desc " has been rebound, but you can use " where " instead [")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
616 (when (and s s2) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
617 (setq s (format s key-desc where s2)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
618 (insert s) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
619 (insert-button s2 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
620 'tutorial-buffer |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
621 (current-buffer) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
622 ;;'tutorial-arg arg |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
623 'action |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
624 'tutorial--detailed-help |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
625 'explain-key-desc key-desc |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
626 'follow-link t |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
627 'face '(:inherit link :background "yellow")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
628 (insert "] **") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
629 (insert "\n") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
630 (setq end (point)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
631 (put-text-property start end 'local-map tutorial--tab-map) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
632 ;; Add a property so we can remove the remark: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
633 (put-text-property start end 'tutorial-remark t) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
634 (put-text-property start end |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
635 'face '(:background "yellow" :foreground "#c00")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
636 (put-text-property start end 'read-only t)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
637 (goto-char here))))))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
638 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
639 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
640 (setq end (point)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
641 ;; Make the area with information about change key |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
642 ;; bindings stand out: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
643 (put-text-property start end 'tutorial-remark t) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
644 (put-text-property start end |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
645 'face |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
646 ;; The default warning face does not |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
647 ;;look good in this situation. Instead |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
648 ;;try something that could be |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
649 ;;recognized from warnings in normal |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
650 ;;life: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
651 ;; 'font-lock-warning-face |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
652 (list :background "yellow" :foreground "#c00")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
653 ;; Make it possible to use Tab/S-Tab between fields in |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
654 ;; this area: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
655 (put-text-property start end 'local-map tutorial--tab-map) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
656 (setq tutorial--point-after-chkeys (point-marker)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
657 ;; Make this area read-only: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
658 (put-text-property start end 'read-only t))))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
659 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
660 (defun tutorial--saved-dir () |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
661 "Directory where to save tutorials." |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
662 (expand-file-name ".emacstut" "~/")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
663 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
664 (defun tutorial--saved-file () |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
665 "File name in which to save tutorials." |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
666 (let ((file-name tutorial--lang) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
667 (ext (file-name-extension tutorial--lang))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
668 (when (or (not ext) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
669 (string= ext "")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
670 (setq file-name (concat file-name ".tut"))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
671 (expand-file-name file-name (tutorial--saved-dir)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
672 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
673 (defun tutorial--remove-remarks() |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
674 "Remove the remark lines that was added to the tutorial buffer." |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
675 (save-excursion |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
676 (goto-char (point-min)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
677 (let (prop-start |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
678 prop-end |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
679 prop-val) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
680 ;; Catch the case when we already are on a remark line |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
681 (while (if (get-text-property (point) 'tutorial-remark) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
682 (setq prop-start (point)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
683 (setq prop-start (next-single-property-change (point) 'tutorial-remark))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
684 (setq prop-end (next-single-property-change prop-start 'tutorial-remark)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
685 (setq prop-val (get-text-property prop-start 'tutorial-remark)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
686 (unless prop-end |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
687 (setq prop-end (point-max))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
688 (goto-char prop-end) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
689 (if (eq prop-val 'only-colored) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
690 (put-text-property prop-start prop-end 'face '(:background nil)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
691 (let ((orig-text (get-text-property prop-start 'tutorial-orig))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
692 (delete-region prop-start prop-end) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
693 (when orig-text (insert orig-text)))))))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
694 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
695 (defun tutorial--save-tutorial () |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
696 "Save the tutorial buffer. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
697 This saves the part of the tutorial before and after the area |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
698 showing changed keys. It also saves the point position and the |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
699 position where the display of changed bindings was inserted." |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
700 ;; This runs in a hook so protect it: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
701 (condition-case err |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
702 (tutorial--save-tutorial-to (tutorial--saved-file)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
703 (error (message "Error saving tutorial state: %s" (error-message-string err)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
704 (sit-for 4)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
705 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
706 (defun tutorial--save-tutorial-to (saved-file) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
707 "Save the tutorial buffer to SAVED-FILE. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
708 See `tutorial--save-tutorial' for more information." |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
709 ;; Anything to save? |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
710 (when (or (buffer-modified-p) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
711 (< 1 (point))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
712 (let ((tutorial-dir (tutorial--saved-dir)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
713 save-err) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
714 ;; The tutorial is saved in a subdirectory in the user home |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
715 ;; directory. Create this subdirectory first. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
716 (unless (file-directory-p tutorial-dir) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
717 (condition-case err |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
718 (make-directory tutorial-dir nil) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
719 (error (setq save-err t) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
720 (warn "Could not create directory %s: %s" tutorial-dir |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
721 (error-message-string err))))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
722 ;; Make sure we have that directory. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
723 (if (file-directory-p tutorial-dir) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
724 (let ((tut-point (if (= 0 tutorial--point-after-chkeys) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
725 ;; No info about changed keys is |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
726 ;; displayed. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
727 (point) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
728 (if (< (point) tutorial--point-after-chkeys) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
729 (- (point)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
730 (- (point) tutorial--point-after-chkeys)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
731 (old-point (point)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
732 ;; Use a special undo list so that we easily can undo |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
733 ;; the changes we make to the tutorial buffer. This is |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
734 ;; currently not needed since we now delete the buffer |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
735 ;; after saving, but kept for possible future use of |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
736 ;; this function. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
737 buffer-undo-list |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
738 (inhibit-read-only t)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
739 ;; Delete the area displaying info about changed keys. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
740 ;; (when (< 0 tutorial--point-after-chkeys) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
741 ;; (delete-region tutorial--point-before-chkeys |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
742 ;; tutorial--point-after-chkeys)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
743 ;; Delete the remarks: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
744 (tutorial--remove-remarks) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
745 ;; Put the value of point first in the buffer so it will |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
746 ;; be saved with the tutorial. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
747 (goto-char (point-min)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
748 (insert (number-to-string tut-point) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
749 "\n" |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
750 (number-to-string (marker-position |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
751 tutorial--point-before-chkeys)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
752 "\n") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
753 (condition-case err |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
754 (write-region nil nil saved-file) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
755 (error (setq save-err t) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
756 (warn "Could not save tutorial to %s: %s" |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
757 saved-file |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
758 (error-message-string err)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
759 ;; An error is raised here?? Is this a bug? |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
760 (condition-case err |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
761 (undo-only) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
762 (error nil)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
763 ;; Restore point |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
764 (goto-char old-point) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
765 (if save-err |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
766 (message "Could not save tutorial state.") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
767 (message "Saved tutorial state."))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
768 (message "Can't save tutorial: %s is not a directory" |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
769 tutorial-dir))))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
770 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
771 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
772 ;;;###autoload |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
773 (defun help-with-tutorial (&optional arg dont-ask-for-revert) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
774 "Select the Emacs learn-by-doing tutorial. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
775 If there is a tutorial version written in the language |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
776 of the selected language environment, that version is used. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
777 If there's no tutorial in that language, `TUTORIAL' is selected. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
778 With ARG, you are asked to choose which language. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
779 If DONT-ASK-FOR-REVERT is non-nil the buffer is reverted without |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
780 any question when restarting the tutorial. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
781 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
782 If any of the standard Emacs key bindings that are used in the |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
783 tutorial have been changed then an explanatory note about this is |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
784 shown in the beginning of the tutorial buffer. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
785 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
786 When the tutorial buffer is killed the content and the point |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
787 position in the buffer is saved so that the tutorial may be |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
788 resumed later." |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
789 (interactive "P") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
790 (if (boundp 'viper-current-state) |
73551
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
791 (let ((prompt1 |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
792 "You can not run the Emacs tutorial directly because you have \ |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
793 enabled Viper.") |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
794 (prompt2 "\nThere is however a Viper tutorial you can run instead. |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
795 Run the Viper tutorial? ")) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
796 (if (fboundp 'viper-tutorial) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
797 (if (y-or-n-p (concat prompt1 prompt2)) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
798 (progn (message "") |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
799 (funcall 'viper-tutorial 0)) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
800 (message "Tutorial aborted by user")) |
8bd77d06776b
* tutorial.el: Move defvars to avoid bytecomp warnings.
Chong Yidong <cyd@stupidchicken.com>
parents:
73550
diff
changeset
|
801 (message prompt1))) |
73550
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
802 (let* ((lang (if arg |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
803 (let ((minibuffer-setup-hook minibuffer-setup-hook)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
804 (add-hook 'minibuffer-setup-hook |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
805 'minibuffer-completion-help) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
806 (read-language-name 'tutorial "Language: " "English")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
807 (if (get-language-info current-language-environment 'tutorial) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
808 current-language-environment |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
809 "English"))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
810 (filename (get-language-info lang 'tutorial)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
811 ;; Choose a buffer name including the language so that |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
812 ;; several languages can be tested simultaneously: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
813 (tut-buf-name (concat "TUTORIAL (" lang ")")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
814 (old-tut-buf (get-buffer tut-buf-name)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
815 (old-tut-win (when old-tut-buf (get-buffer-window old-tut-buf t))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
816 (old-tut-is-ok (when old-tut-buf |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
817 (not (buffer-modified-p old-tut-buf)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
818 old-tut-file |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
819 (old-tut-point 1)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
820 (setq tutorial--point-after-chkeys (point-min)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
821 ;; Try to display the tutorial buffer before asking to revert it. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
822 ;; If the tutorial buffer is shown in some window make sure it is |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
823 ;; selected and displayed: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
824 (if old-tut-win |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
825 (raise-frame |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
826 (window-frame |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
827 (select-window (get-buffer-window old-tut-buf t)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
828 ;; Else, is there an old tutorial buffer? Then display it: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
829 (when old-tut-buf |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
830 (switch-to-buffer old-tut-buf))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
831 ;; Use whole frame for tutorial |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
832 (delete-other-windows) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
833 ;; If the tutorial buffer has been changed then ask if it should |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
834 ;; be reverted: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
835 (when (and old-tut-buf |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
836 (not old-tut-is-ok)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
837 (setq old-tut-is-ok |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
838 (if dont-ask-for-revert |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
839 nil |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
840 (not (y-or-n-p |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
841 "You have changed the Tutorial buffer. Revert it? "))))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
842 ;; (Re)build the tutorial buffer if it is not ok |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
843 (unless old-tut-is-ok |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
844 (switch-to-buffer (get-buffer-create tut-buf-name)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
845 (unless old-tut-buf (text-mode)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
846 (unless lang (error "Variable lang is nil")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
847 (setq tutorial--lang lang) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
848 (setq old-tut-file (file-exists-p (tutorial--saved-file))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
849 (let ((inhibit-read-only t)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
850 (erase-buffer)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
851 (message "Preparing tutorial ...") (sit-for 0) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
852 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
853 ;; Do not associate the tutorial buffer with a file. Instead use |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
854 ;; a hook to save it when the buffer is killed. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
855 (setq buffer-auto-save-file-name nil) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
856 (add-hook 'kill-buffer-hook 'tutorial--save-tutorial nil t) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
857 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
858 ;; Insert the tutorial. First offer to resume last tutorial |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
859 ;; editing session. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
860 (when dont-ask-for-revert |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
861 (setq old-tut-file nil)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
862 (when old-tut-file |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
863 (setq old-tut-file |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
864 (y-or-n-p "Resume your last saved tutorial? "))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
865 (if old-tut-file |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
866 (progn |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
867 (insert-file-contents (tutorial--saved-file)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
868 (goto-char (point-min)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
869 (setq old-tut-point |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
870 (string-to-number |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
871 (buffer-substring-no-properties |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
872 (line-beginning-position) (line-end-position)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
873 (forward-line) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
874 (setq tutorial--point-before-chkeys |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
875 (string-to-number |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
876 (buffer-substring-no-properties |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
877 (line-beginning-position) (line-end-position)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
878 (forward-line) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
879 (delete-region (point-min) (point)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
880 (goto-char tutorial--point-before-chkeys) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
881 (setq tutorial--point-before-chkeys (point-marker))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
882 (insert-file-contents (expand-file-name filename data-directory)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
883 (forward-line) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
884 (setq tutorial--point-before-chkeys (point-marker))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
885 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
886 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
887 ;; Check if there are key bindings that may disturb the |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
888 ;; tutorial. If so tell the user. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
889 (let ((changed-keys (tutorial--find-changed-keys tutorial--default-keys))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
890 (when changed-keys |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
891 (tutorial--display-changes changed-keys))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
892 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
893 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
894 ;; Clear message: |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
895 (unless dont-ask-for-revert |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
896 (message "") (sit-for 0)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
897 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
898 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
899 (if old-tut-file |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
900 ;; Just move to old point in saved tutorial. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
901 (let ((old-point |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
902 (if (> 0 old-tut-point) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
903 (- old-tut-point) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
904 (+ old-tut-point tutorial--point-after-chkeys)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
905 (when (< old-point 1) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
906 (setq old-point 1)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
907 (goto-char old-point)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
908 (goto-char (point-min)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
909 (search-forward "\n<<") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
910 (beginning-of-line) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
911 ;; Convert the <<...>> line to the proper [...] line, |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
912 ;; or just delete the <<...>> line if a [...] line follows. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
913 (cond ((save-excursion |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
914 (forward-line 1) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
915 (looking-at "\\[")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
916 (delete-region (point) (progn (forward-line 1) (point)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
917 ((looking-at "<<Blank lines inserted.*>>") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
918 (replace-match "[Middle of page left blank for didactic purposes. Text continues below]")) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
919 (t |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
920 (looking-at "<<") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
921 (replace-match "[") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
922 (search-forward ">>") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
923 (replace-match "]"))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
924 (beginning-of-line) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
925 (let ((n (- (window-height (selected-window)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
926 (count-lines (point-min) (point)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
927 6))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
928 (if (< n 8) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
929 (progn |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
930 ;; For a short gap, we don't need the [...] line, |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
931 ;; so delete it. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
932 (delete-region (point) (progn (end-of-line) (point))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
933 (newline n)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
934 ;; Some people get confused by the large gap. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
935 (newline (/ n 2)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
936 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
937 ;; Skip the [...] line (don't delete it). |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
938 (forward-line 1) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
939 (newline (- n (/ n 2))))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
940 (goto-char (point-min))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
941 (setq buffer-undo-list nil) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
942 (set-buffer-modified-p nil))))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
943 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
944 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
945 ;; Below is some attempt to handle language specific strings. These |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
946 ;; are currently only used in the tutorial. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
947 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
948 (defconst lang-strings |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
949 '( |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
950 ("English" . |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
951 ( |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
952 (tut-chgdkey . "** The key %s has been rebound, but you can use %s instead [") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
953 (tut-chgdkey2 . "More information") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
954 (tut-chgdhead . " |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
955 NOTICE: The main purpose of the Emacs tutorial is to teach you |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
956 the most important standard Emacs commands (key bindings). |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
957 However, your Emacs has been customized by changing some of |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
958 these basic editing commands, so it doesn't correspond to the |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
959 tutorial. We have inserted colored notices where the altered |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
960 commands have been introduced. [") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
961 (tut-chgdhead2 . "Details") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
962 ) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
963 ) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
964 ) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
965 "Language specific strings for Emacs. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
966 This is an association list with the keys equal to the strings |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
967 that can be returned by `read-language-name'. The elements in |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
968 the list are themselves association lists with keys that are |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
969 string ids and values that are the language specific strings. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
970 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
971 See `get-lang-string' for more information.") |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
972 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
973 (defun get-lang-string(lang stringid &optional no-eng-fallback) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
974 "Get a language specific string for Emacs. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
975 In certain places Emacs can replace a string showed to the user with a language specific string. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
976 This function retrieves such strings. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
977 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
978 LANG is the language specification. It should be one of those |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
979 strings that can be returned by `read-language-name'. STRINGID |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
980 is a symbol that specifies the string to retrieve. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
981 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
982 If no string is found for STRINGID in the choosen language then |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
983 the English string is returned unless NO-ENG-FALLBACK is non-nil. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
984 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
985 See `lang-strings' for more information. |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
986 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
987 Currently this feature is only used in `help-with-tutorial'." |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
988 (let ((my-lang-strings (assoc lang lang-strings)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
989 (found-string)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
990 (when my-lang-strings |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
991 (let ((entry (assoc stringid (cdr my-lang-strings)))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
992 (when entry |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
993 (setq found-string (cdr entry))))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
994 ;; Fallback to English strings |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
995 (unless (or found-string |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
996 no-eng-fallback) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
997 (setq found-string (get-lang-string "English" stringid t))) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
998 found-string)) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
999 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1000 ;;(get-lang-string "English" 'tut-chgdkey) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1001 |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1002 (provide 'tutorial) |
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1003 |
73567 | 1004 ;; arch-tag: c8e80aef-c3bb-4ffb-8af6-22171bf0c100 |
73550
6deaec97f21b
* help-fns.el (help-with-tutorial): Moved to tutorial.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1005 ;;; tutorial.el ends here |