changeset 74113:3cc044eb98b7

(tutorial--default-keys): Add newline and delete-backward-char bindings. (tutorial--detailed-help): Save excursion when finding keys. Correct warning string for M-x FOO case. (tutorial--display-changes): Print special keys in tutorial style. Tweak search regexp for changed keys.
author Chong Yidong <cyd@stupidchicken.com>
date Tue, 21 Nov 2006 16:11:30 +0000
parents 806be7aaa61b
children cd686b5380c4
files lisp/tutorial.el
diffstat 1 files changed, 23 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/tutorial.el	Tue Nov 21 16:11:13 2006 +0000
+++ b/lisp/tutorial.el	Tue Nov 21 16:11:30 2006 +0000
@@ -255,6 +255,7 @@
              (backward-sentence [?\M-a])
              (forward-sentence [?\M-e])
 
+             (newline "\r")
 
              (beginning-of-buffer [?\M-<])
              (end-of-buffer [?\M->])
@@ -280,6 +281,7 @@
              ;; C-u 8 * to insert ********.
 
              (delete-backward-char [backspace])
+             (delete-backward-char "\d")
              (delete-char [?\C-d])
 
              (backward-kill-word [(meta backspace)])
@@ -375,7 +377,10 @@
              ;;(tutorial-arg     (button-get button 'tutorial-arg))
              (explain-key-desc (button-get button 'explain-key-desc))
              (changed-keys (with-current-buffer tutorial-buffer
-                             (tutorial--find-changed-keys tutorial--default-keys))))
+                             (save-excursion
+                               (goto-char (point-min))
+                               (tutorial--find-changed-keys
+				tutorial--default-keys)))))
         (when changed-keys
           (insert
            "The following key bindings used in the tutorial had been changed
@@ -416,7 +421,10 @@
                 (when (listp where)
                   (setq where "list"))
                 ;; Tell where the old binding is now:
-                (insert (format " %-11s " where))
+                (insert (format " %-11s "
+                                (if (string= "" where)
+                                    (format "M-x %s" def-fun-txt)
+                                  where)))
                 ;; Insert a link with more information, for example
                 ;; current binding and keymap or information about
                 ;; cua-mode replacements:
@@ -616,14 +624,21 @@
                   (let ((here (point))
 			(case-fold-search nil)
                         (key-desc (key-description key)))
+                    (cond ((string= "ESC" key-desc)
+			   (setq key-desc "<ESC>"))
+			  ((string= "RET" key-desc)
+			   (setq key-desc "<Return>"))
+			  ((string= "DEL" key-desc)
+			   (setq key-desc "<Delback>")))
                     (while (re-search-forward
-			    (concat (regexp-quote key-desc)
-				    "[[:space:]]") nil t)
-                      (put-text-property (match-beginning 0)
-                                         (match-end 0)
+			    (concat "[[:space:]]\\("
+                                    (regexp-quote key-desc)
+				    "\\)[[:space:]]") nil t)
+                      (put-text-property (match-beginning 1)
+                                         (match-end 1)
                                          'tutorial-remark 'only-colored)
-                      (put-text-property (match-beginning 0)
-                                         (match-end 0)
+                      (put-text-property (match-beginning 1)
+                                         (match-end 1)
                                          'face 'tutorial-warning-face)
                       (forward-line)
                       (let ((s  (get-lang-string tutorial--lang 'tut-chgdkey))