diff lisp/help.el @ 278:90d73dddcdc4 r21-0b37

Import from CVS: tag r21-0b37
author cvs
date Mon, 13 Aug 2007 10:31:29 +0200
parents c5d627a313b1
children 7df0dd720c89
line wrap: on
line diff
--- a/lisp/help.el	Mon Aug 13 10:30:38 2007 +0200
+++ b/lisp/help.el	Mon Aug 13 10:31:29 2007 +0200
@@ -762,21 +762,28 @@
       (while (progn (move-to-column 50) (not (eobp)))
 	(search-forward " " nil t)
 	(insert "\n")))
-    ;; XEmacs addition
+    ;; XEmacs addition: copy the messages from " *Message-Log*",
+    ;; reversing their order and handling multiline messages
+    ;; correctly.
     (princ "\n\n\nRecent minibuffer messages (most recent first):\n\n")
     (save-excursion
       (let ((buffer (get-buffer-create " *Message-Log*"))
 	    (count 0)
-	    oldpoint)
-	(set-buffer buffer)
-	(goto-char (point-max))
+	    oldpoint extent)
+	(goto-char (point-max buffer) buffer)
 	(set-buffer standard-output)
-	(while (and (> (point buffer) (point-min buffer))
+	(while (and (not (bobp buffer))
 		    (< count view-lossage-message-count))
 	  (setq oldpoint (point buffer))
-	  (forward-line -1 buffer)
+	  (setq extent (extent-at oldpoint buffer
+				  'message-multiline nil 'before))
+	  ;; If the message was multiline, move all the way to the
+	  ;; beginning.
+	  (if extent
+	      (goto-char (extent-start-position extent) buffer)
+	    (forward-line -1 buffer))
 	  (insert-buffer-substring buffer (point buffer) oldpoint)
-	  (setq count (1+ count)))))))
+	  (incf count))))))
 
 (define-function 'help 'help-for-help)