diff options
| author | Richard M. Stallman | 2007-01-28 07:08:51 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2007-01-28 07:08:51 +0000 |
| commit | 7378b2f99549146ef3dc1180592cfa7111fb71c0 (patch) | |
| tree | 2dc85c63cd285fa5859cc5e01e8c3bcf7a89be38 /lisp/tutorial.el | |
| parent | 5650acf81b80bdb1e8f181d9125e7e007303a0aa (diff) | |
| download | emacs-7378b2f99549146ef3dc1180592cfa7111fb71c0.tar.gz emacs-7378b2f99549146ef3dc1180592cfa7111fb71c0.zip | |
(tutorial--default-keys): Check M-DEL, not `M-backspace'.
Don't check `backspace'.
(tutorial--find-changed-keys): Look up bindings in a temp buffer
in Fundamental mode.
Diffstat (limited to 'lisp/tutorial.el')
| -rw-r--r-- | lisp/tutorial.el | 179 |
1 files changed, 91 insertions, 88 deletions
diff --git a/lisp/tutorial.el b/lisp/tutorial.el index 18fa2f0d4cd..c446400d906 100644 --- a/lisp/tutorial.el +++ b/lisp/tutorial.el | |||
| @@ -250,10 +250,9 @@ LEFT and RIGHT are the elements to compare." | |||
| 250 | 250 | ||
| 251 | ;; * INSERTING AND DELETING | 251 | ;; * INSERTING AND DELETING |
| 252 | ;; C-u 8 * to insert ********. | 252 | ;; C-u 8 * to insert ********. |
| 253 | (delete-backward-char [backspace]) | ||
| 254 | (delete-backward-char "\d") | 253 | (delete-backward-char "\d") |
| 255 | (delete-char [?\C-d]) | 254 | (delete-char [?\C-d]) |
| 256 | (backward-kill-word [(meta backspace)]) | 255 | (backward-kill-word [?\M-\d]) |
| 257 | (kill-word [?\M-d]) | 256 | (kill-word [?\M-d]) |
| 258 | (kill-line [?\C-k]) | 257 | (kill-line [?\C-k]) |
| 259 | (kill-sentence [?\M-k]) | 258 | (kill-sentence [?\M-k]) |
| @@ -422,90 +421,94 @@ where | |||
| 422 | QUIET is t if this changed keybinding should be handled quietly. | 421 | QUIET is t if this changed keybinding should be handled quietly. |
| 423 | This is used by `tutorial--display-changes'." | 422 | This is used by `tutorial--display-changes'." |
| 424 | (let (changed-keys remark) | 423 | (let (changed-keys remark) |
| 425 | (dolist (kdf default-keys) | 424 | ;; Look up the bindings in a Fundamental mode buffer |
| 426 | ;; The variables below corresponds to those with the same names | 425 | ;; so we do not get fooled by some other major mode. |
| 427 | ;; described in the doc string. | 426 | (with-temp-buffer |
| 428 | (let* ((key (nth 1 kdf)) | 427 | (fundamental-mode) |
| 429 | (def-fun (nth 0 kdf)) | 428 | (dolist (kdf default-keys) |
| 430 | (def-fun-txt (format "%s" def-fun)) | 429 | ;; The variables below corresponds to those with the same names |
| 431 | (rem-fun (command-remapping def-fun)) | 430 | ;; described in the doc string. |
| 432 | (key-fun (if (eq def-fun 'ESC-prefix) | 431 | (let* ((key (nth 1 kdf)) |
| 433 | (lookup-key global-map [27]) | 432 | (def-fun (nth 0 kdf)) |
| 434 | (key-binding key))) | 433 | (def-fun-txt (format "%s" def-fun)) |
| 435 | (where (where-is-internal (if rem-fun rem-fun def-fun)))) | 434 | (rem-fun (command-remapping def-fun)) |
| 436 | (if where | 435 | (key-fun (if (eq def-fun 'ESC-prefix) |
| 437 | (progn | 436 | (lookup-key global-map [27]) |
| 438 | (setq where (key-description (car where))) | 437 | (key-binding key))) |
| 439 | (when (and (< 10 (length where)) | 438 | (where (where-is-internal (if rem-fun rem-fun def-fun)))) |
| 440 | (string= (substring where 0 (length "<menu-bar>")) | 439 | (if where |
| 441 | "<menu-bar>")) | 440 | (progn |
| 442 | (setq where "the menus"))) | 441 | (setq where (key-description (car where))) |
| 443 | (setq where "")) | 442 | (when (and (< 10 (length where)) |
| 444 | (setq remark nil) | 443 | (string= (substring where 0 (length "<menu-bar>")) |
| 445 | (unless | 444 | "<menu-bar>")) |
| 446 | (cond ((eq key-fun def-fun) | 445 | (setq where "the menus"))) |
| 447 | ;; No rebinding, return t | 446 | (setq where "")) |
| 448 | t) | 447 | (setq remark nil) |
| 449 | ((and key-fun | 448 | (unless |
| 450 | (eq key-fun (command-remapping def-fun))) | 449 | (cond ((eq key-fun def-fun) |
| 451 | ;; Just a remapping, return t | 450 | ;; No rebinding, return t |
| 452 | t) | 451 | t) |
| 453 | ;; cua-mode specials: | 452 | ((and key-fun |
| 454 | ((and cua-mode | 453 | (eq key-fun (command-remapping def-fun))) |
| 455 | (or (and | 454 | ;; Just a remapping, return t |
| 456 | (equal key [?\C-v]) | 455 | t) |
| 457 | (eq key-fun 'cua-paste)) | 456 | ;; cua-mode specials: |
| 458 | (and | 457 | ((and cua-mode |
| 459 | (equal key [?\C-z]) | 458 | (or (and |
| 460 | (eq key-fun 'undo)))) | 459 | (equal key [?\C-v]) |
| 461 | (setq remark (list "cua-mode, more info" 'cua-mode)) | 460 | (eq key-fun 'cua-paste)) |
| 462 | nil) | 461 | (and |
| 463 | ((and cua-mode | 462 | (equal key [?\C-z]) |
| 464 | (or (and (eq def-fun 'ESC-prefix) | 463 | (eq key-fun 'undo)))) |
| 465 | (equal key-fun | 464 | (setq remark (list "cua-mode, more info" 'cua-mode)) |
| 466 | `(keymap | 465 | nil) |
| 467 | (118 . cua-repeat-replace-region))) | 466 | ((and cua-mode |
| 468 | (setq def-fun-txt "\"ESC prefix\"")) | 467 | (or (and (eq def-fun 'ESC-prefix) |
| 469 | (and (eq def-fun 'mode-specific-command-prefix) | 468 | (equal key-fun |
| 470 | (equal key-fun | 469 | `(keymap |
| 471 | '(keymap | 470 | (118 . cua-repeat-replace-region))) |
| 472 | (timeout . copy-region-as-kill))) | 471 | (setq def-fun-txt "\"ESC prefix\"")) |
| 473 | (setq def-fun-txt "\"C-c prefix\"")) | 472 | (and (eq def-fun 'mode-specific-command-prefix) |
| 474 | (and (eq def-fun 'Control-X-prefix) | 473 | (equal key-fun |
| 475 | (equal key-fun | 474 | '(keymap |
| 476 | '(keymap (timeout . kill-region))) | 475 | (timeout . copy-region-as-kill))) |
| 477 | (setq def-fun-txt "\"C-x prefix\"")))) | 476 | (setq def-fun-txt "\"C-c prefix\"")) |
| 478 | (setq remark (list "cua-mode replacement" 'cua-mode)) | 477 | (and (eq def-fun 'Control-X-prefix) |
| 479 | (setq where "Same key") | 478 | (equal key-fun |
| 480 | nil) | 479 | '(keymap (timeout . kill-region))) |
| 481 | ;; viper-mode specials: | 480 | (setq def-fun-txt "\"C-x prefix\"")))) |
| 482 | ((and (boundp 'viper-mode-string) | 481 | (setq remark (list "cua-mode replacement" 'cua-mode)) |
| 483 | (boundp 'viper-current-state) | 482 | (setq where "Same key") |
| 484 | (eq viper-current-state 'vi-state) | 483 | nil) |
| 485 | (or (and (eq def-fun 'isearch-forward) | 484 | ;; viper-mode specials: |
| 486 | (eq key-fun 'viper-isearch-forward)) | 485 | ((and (boundp 'viper-mode-string) |
| 487 | (and (eq def-fun 'isearch-backward) | 486 | (boundp 'viper-current-state) |
| 488 | (eq key-fun 'viper-isearch-backward)))) | 487 | (eq viper-current-state 'vi-state) |
| 489 | ;; These bindings works as the default bindings, | 488 | (or (and (eq def-fun 'isearch-forward) |
| 490 | ;; return t | 489 | (eq key-fun 'viper-isearch-forward)) |
| 491 | t) | 490 | (and (eq def-fun 'isearch-backward) |
| 492 | ((when normal-erase-is-backspace | 491 | (eq key-fun 'viper-isearch-backward)))) |
| 493 | (or (and (equal key [C-delete]) | 492 | ;; These bindings works as the default bindings, |
| 494 | (equal key-fun 'kill-word)) | 493 | ;; return t |
| 495 | (and (equal key [C-backspace]) | 494 | t) |
| 496 | (equal key-fun 'backward-kill-word)))) | 495 | ((when normal-erase-is-backspace |
| 497 | ;; This is the strange handling of C-delete and | 496 | (or (and (equal key [C-delete]) |
| 498 | ;; C-backspace, return t | 497 | (equal key-fun 'kill-word)) |
| 499 | t) | 498 | (and (equal key [C-backspace]) |
| 500 | (t | 499 | (equal key-fun 'backward-kill-word)))) |
| 501 | ;; This key has indeed been rebound. Put information | 500 | ;; This is the strange handling of C-delete and |
| 502 | ;; in `remark' and return nil | 501 | ;; C-backspace, return t |
| 503 | (setq remark | 502 | t) |
| 504 | (list "more info" 'current-binding | 503 | (t |
| 505 | key-fun def-fun key where)) | 504 | ;; This key has indeed been rebound. Put information |
| 506 | nil)) | 505 | ;; in `remark' and return nil |
| 507 | (add-to-list 'changed-keys | 506 | (setq remark |
| 508 | (list key def-fun def-fun-txt where remark nil))))) | 507 | (list "more info" 'current-binding |
| 508 | key-fun def-fun key where)) | ||
| 509 | nil)) | ||
| 510 | (add-to-list 'changed-keys | ||
| 511 | (list key def-fun def-fun-txt where remark nil)))))) | ||
| 509 | changed-keys)) | 512 | changed-keys)) |
| 510 | 513 | ||
| 511 | (defun tutorial--key-description (key) | 514 | (defun tutorial--key-description (key) |
| @@ -621,7 +624,7 @@ with some explanatory links." | |||
| 621 | (setq file-name (concat file-name ".tut"))) | 624 | (setq file-name (concat file-name ".tut"))) |
| 622 | (expand-file-name file-name (tutorial--saved-dir)))) | 625 | (expand-file-name file-name (tutorial--saved-dir)))) |
| 623 | 626 | ||
| 624 | (defun tutorial--remove-remarks() | 627 | (defun tutorial--remove-remarks () |
| 625 | "Remove the remark lines that was added to the tutorial buffer." | 628 | "Remove the remark lines that was added to the tutorial buffer." |
| 626 | (save-excursion | 629 | (save-excursion |
| 627 | (goto-char (point-min)) | 630 | (goto-char (point-min)) |
| @@ -908,7 +911,7 @@ string ids and values that are the language specific strings. | |||
| 908 | 911 | ||
| 909 | See `get-lang-string' for more information.") | 912 | See `get-lang-string' for more information.") |
| 910 | 913 | ||
| 911 | (defun get-lang-string(lang stringid &optional no-eng-fallback) | 914 | (defun get-lang-string (lang stringid &optional no-eng-fallback) |
| 912 | "Get a language specific string for Emacs. | 915 | "Get a language specific string for Emacs. |
| 913 | In certain places Emacs can replace a string showed to the user with a language specific string. | 916 | In certain places Emacs can replace a string showed to the user with a language specific string. |
| 914 | This function retrieves such strings. | 917 | This function retrieves such strings. |