In its attempt to be helpful and reverse the order of the messages in
message-log, `view-lossage' screws up the multiline messages, showing
them in reverse. This has annoyed me sufficiently to fix it. The fix
is for log-message to mark the multiline messages in the message-log
with an extent, and for view-lossage to recognize that mark.
I've tested this as far as I could, but I'd appreciate feedback.
After applying this patch, please keep your eyes open for any
anomalies in `view-lossage' operation.
1998-04-23 Hrvoje Niksic <hniksic(a)srce.hr>
* help.el (view-lossage): Recognize it.
* simple.el (log-message): Mark multiline messages.
--- lisp/simple.el.orig Thu Apr 23 05:29:28 1998
+++ lisp/simple.el Thu Apr 23 06:01:26 1998
@@ -3603,12 +3603,23 @@
For use on `remove-message-hook'."
(when (and (not noninteractive)
(funcall log-message-filter-function label message))
- (with-current-buffer (get-buffer-create " *Message-Log*")
+ ;; Use save-excursion rather than save-current-buffer because we
+ ;; change the value of point.
+ (save-excursion
+ (set-buffer (get-buffer-create " *Message-Log*"))
(goto-char (point-max))
- ;; (insert (concat (upcase (symbol-name label)) ": " message
"\n"))
- (insert message "\n")
+ ;(insert (concat (upcase (symbol-name label)) ": " message
"\n"))
+ (let (extent)
+ ;; Mark multiline message with an extent, which `view-lossage'
+ ;; will recognize.
+ (when (string-match "\n" message)
+ (setq extent (make-extent (point) (point)))
+ (set-extent-properties extent '(end-open nil message-multiline t)))
+ (insert message "\n")
+ (when extent
+ (set-extent-property extent 'end-open t)))
(when (> (point-max) (max log-message-max-size (point-min)))
- ;; trim log to ~90% of max size
+ ;; Trim log to ~90% of max size.
(goto-char (max (- (point-max)
(truncate (* 0.9 log-message-max-size)))
(point-min)))
--- lisp/help.el.orig Thu Apr 23 05:42:49 1998
+++ lisp/help.el Thu Apr 23 06:14:37 1998
@@ -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)
--
Hrvoje Niksic <hniksic(a)srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
* Q: What is an experienced Emacs user?
* A: A person who wishes that the terminal had pedals.