* lisp/tutorial.el (help-with-tutorial): Avoid an error on short screens.
authorGlenn Morris <rgm@gnu.org>
Sat, 20 Aug 2011 22:53:00 +0000 (15:53 -0700)
committerGlenn Morris <rgm@gnu.org>
Sat, 20 Aug 2011 22:53:00 +0000 (15:53 -0700)
lisp/ChangeLog
lisp/tutorial.el

index 4763c83..c655c49 100644 (file)
@@ -1,5 +1,7 @@
 2011-08-20  Glenn Morris  <rgm@gnu.org>
 
+       * tutorial.el (help-with-tutorial): Avoid an error on short screens.
+
        * tutorial.el (tutorial--default-keys): Update some default bindings.
 
        * files.el (hack-local-variables): Fully ignore case for "mode:".
index d47079a..c57ec33 100644 (file)
@@ -889,6 +889,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 +902,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))