comparison lisp/help.el @ 298:70ad99077275 r21-0b47

Import from CVS: tag r21-0b47
author cvs
date Mon, 13 Aug 2007 10:39:40 +0200
parents 558f606b08ae
children afd57c14dfc8
comparison
equal deleted inserted replaced
297:deca3c1083ac 298:70ad99077275
760 (defcustom view-lossage-message-count 100 760 (defcustom view-lossage-message-count 100
761 "*Number of minibuffer messages `view-lossage' shows." 761 "*Number of minibuffer messages `view-lossage' shows."
762 :type 'integer 762 :type 'integer
763 :group 'help) 763 :group 'help)
764 764
765 (defun print-recent-messages (n)
766 "Print N most recent messages to standard-output, most recent first.
767 If N is nil, all messages will be printed."
768 (save-excursion
769 (let ((buffer (get-buffer-create " *Message-Log*"))
770 oldpoint extent)
771 (goto-char (point-max buffer) buffer)
772 (set-buffer standard-output)
773 (while (and (not (bobp buffer))
774 (or (null n) (>= (decf n) 0)))
775 (setq oldpoint (point buffer))
776 (setq extent (extent-at oldpoint buffer
777 'message-multiline nil 'before))
778 ;; If the message was multiline, move all the way to the
779 ;; beginning.
780 (if extent
781 (goto-char (extent-start-position extent) buffer)
782 (forward-line -1 buffer))
783 (insert-buffer-substring buffer (point buffer) oldpoint)))))
784
765 (defun view-lossage () 785 (defun view-lossage ()
766 "Display recent input keystrokes and recent minibuffer messages. 786 "Display recent input keystrokes and recent minibuffer messages.
767 The number of keys shown is controlled by `view-lossage-key-count'. 787 The number of keys shown is controlled by `view-lossage-key-count'.
768 The number of messages shown is controlled by `view-lossage-message-count'." 788 The number of messages shown is controlled by `view-lossage-message-count'."
769 (interactive) 789 (interactive)
779 (insert "\n"))) 799 (insert "\n")))
780 ;; XEmacs addition: copy the messages from " *Message-Log*", 800 ;; XEmacs addition: copy the messages from " *Message-Log*",
781 ;; reversing their order and handling multiline messages 801 ;; reversing their order and handling multiline messages
782 ;; correctly. 802 ;; correctly.
783 (princ "\n\n\nRecent minibuffer messages (most recent first):\n\n") 803 (princ "\n\n\nRecent minibuffer messages (most recent first):\n\n")
784 (save-excursion 804 (print-recent-messages view-lossage-message-count))
785 (let ((buffer (get-buffer-create " *Message-Log*"))
786 (count 0)
787 oldpoint extent)
788 (goto-char (point-max buffer) buffer)
789 (set-buffer standard-output)
790 (while (and (not (bobp buffer))
791 (< count view-lossage-message-count))
792 (setq oldpoint (point buffer))
793 (setq extent (extent-at oldpoint buffer
794 'message-multiline nil 'before))
795 ;; If the message was multiline, move all the way to the
796 ;; beginning.
797 (if extent
798 (goto-char (extent-start-position extent) buffer)
799 (forward-line -1 buffer))
800 (insert-buffer-substring buffer (point buffer) oldpoint)
801 (incf count)))))
802 "lossage")) 805 "lossage"))
803 806
804 (define-function 'help 'help-for-help) 807 (define-function 'help 'help-for-help)
805 808
806 (make-help-screen help-for-help 809 (make-help-screen help-for-help