From: Richard M. Stallman Date: Sat, 14 Aug 1993 07:54:59 +0000 (+0000) Subject: (momentary-string-display): Scroll to keep the string on the screen. X-Git-Tag: emacs-19.34~11231 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3eec84bf8138d70c6bb15758c9c51cbb6581d789;p=emacs.git (momentary-string-display): Scroll to keep the string on the screen. --- diff --git a/lisp/subr.el b/lisp/subr.el index 3b0f31bdc10..b2b27e62ba4 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -566,7 +566,17 @@ If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there." ;; defeat file locking... don't try this at home, kids! (setq buffer-file-name nil) (insert-before-markers string) - (setq insert-end (point))) + (setq insert-end (point)) + ;; If the message end is off screen, recenter now. + (if (> (window-end) insert-end) + (recenter (/ (window-height) 2))) + ;; If that pushed message start off the screen, + ;; scroll to start it at the top of the screen. + (move-to-window-line 0) + (if (> (point) pos) + (progn + (goto-char pos) + (recenter 0)))) (message (or message "Type %s to continue editing.") (single-key-description exit-char)) (let ((char (read-event)))