X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/be520aca79dd429d55012a1916bdc97f06773fc5..a9bc03e28e99ca44a7e009de25fa7084aec4c60c:/lisp/tutorial.el diff --git a/lisp/tutorial.el b/lisp/tutorial.el index 77ef50843d..39eb9e8b9a 100644 --- a/lisp/tutorial.el +++ b/lisp/tutorial.el @@ -1,6 +1,6 @@ ;;; tutorial.el --- tutorial for Emacs -;; Copyright (C) 2006-2011 Free Software Foundation, Inc. +;; Copyright (C) 2006-2013 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: help, internal @@ -182,7 +182,7 @@ LEFT and RIGHT are the elements to compare." (equal (car x) (car y))) (setq x (cdr x)) (setq y (cdr y))) - ;; Try to make a comparision that is useful for presentation (this + ;; Try to make a comparison that is useful for presentation (this ;; could be made nicer perhaps): (let ((cx (car x)) (cy (car y))) @@ -253,7 +253,7 @@ LEFT and RIGHT are the elements to compare." ;; * INSERTING AND DELETING ;; C-u 8 * to insert ********. (delete-backward-char "\d") - (delete-forward-char [?\C-d]) + (delete-char [?\C-d]) (backward-kill-word [?\M-\d]) (kill-word [?\M-d]) (kill-line [?\C-k]) @@ -298,7 +298,7 @@ LEFT and RIGHT are the elements to compare." (isearch-backward [?\C-r]) ;; * MULTIPLE WINDOWS - (split-window-vertically [?\C-x ?2]) + (split-window-below [?\C-x ?2]) (scroll-other-window [?\C-\M-v]) (other-window [?\C-x ?o]) (find-file-other-window [?\C-x ?4 ?\C-f]) @@ -585,7 +585,6 @@ with some explanatory links." (not (get-text-property (match-beginning 1) 'tutorial-remark)) (let* ((desc (car changed-key)) (ck (cdr changed-key)) - (key (nth 0 ck)) (def-fun (nth 1 ck)) (where (nth 3 ck)) s1 s2 help-string) @@ -724,7 +723,7 @@ See `tutorial--save-tutorial' for more information." saved-file (error-message-string err)))) ;; An error is raised here?? Is this a bug? - (condition-case err + (condition-case nil (undo-only) (error nil)) ;; Restore point @@ -766,14 +765,13 @@ Run the Viper tutorial? ")) (funcall 'viper-tutorial 0)) (message "Tutorial aborted by user")) (message prompt1))) - (let* ((lang (if arg - (let ((minibuffer-setup-hook minibuffer-setup-hook)) - (add-hook 'minibuffer-setup-hook - 'minibuffer-completion-help) - (read-language-name 'tutorial "Language: " "English")) - (if (get-language-info current-language-environment 'tutorial) - current-language-environment - "English"))) + (let* ((lang (cond + (arg + (minibuffer-with-setup-hook #'minibuffer-completion-help + (read-language-name 'tutorial "Language: " "English"))) + ((get-language-info current-language-environment 'tutorial) + current-language-environment) + (t "English"))) (filename (get-language-info lang 'tutorial)) (tut-buf-name filename) (old-tut-buf (get-buffer tut-buf-name)) @@ -830,7 +828,9 @@ Run the Viper tutorial? ")) (if old-tut-file (progn (insert-file-contents (tutorial--saved-file)) - (let ((enable-local-variables :safe)) + (let ((enable-local-variables :safe) + (enable-local-eval nil) + (enable-dir-local-variables nil)) ; bug#11127 (hack-local-variables)) (goto-char (point-min)) (setq old-tut-point @@ -847,7 +847,9 @@ Run the Viper tutorial? ")) (goto-char tutorial--point-before-chkeys) (setq tutorial--point-before-chkeys (point-marker))) (insert-file-contents (expand-file-name filename tutorial-directory)) - (let ((enable-local-variables :safe)) + (let ((enable-local-variables :safe) + (enable-local-eval nil) + (enable-dir-local-variables nil)) ; bug#11127 (hack-local-variables)) (forward-line) (setq tutorial--point-before-chkeys (point-marker))) @@ -889,6 +891,11 @@ Run the Viper tutorial? ")) (search-forward ">>") (replace-match "]"))) (beginning-of-line) + ;; FIXME: if the window is not tall, and especially if the + ;; big red "NOTICE: The main purpose..." text has been + ;; inserted at the start of the buffer, the "type C-v to + ;; move to the next screen" might not be visible on the + ;; first screen (n < 0). How will the novice know what to do? (let ((n (- (window-height (selected-window)) (count-lines (point-min) (point)) 6))) @@ -897,7 +904,7 @@ Run the Viper tutorial? ")) ;; For a short gap, we don't need the [...] line, ;; so delete it. (delete-region (point) (progn (end-of-line) (point))) - (newline n)) + (if (> n 0) (newline n))) ;; Some people get confused by the large gap. (newline (/ n 2))