From: ueno Date: Fri, 19 Nov 2004 08:04:55 +0000 (+0000) Subject: * riece-xemacs.el (riece-recent-messages): New function. X-Git-Tag: riece-1_0_6~44 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=9f492ce034b06fd202934d69da4d486729d3a42e;p=elisp%2Friece.git * riece-xemacs.el (riece-recent-messages): New function. * riece-emacs.el (riece-recent-messages): New function. * riece.el (riece-submit-bug-report): Use riece-recent-messages instead of (with-output-string (print-recent-messages ...)). --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d987f45..1460097 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2004-11-19 Daiki Ueno + + * riece-xemacs.el (riece-recent-messages): New function. + * riece-emacs.el (riece-recent-messages): New function. + * riece.el (riece-submit-bug-report): Use riece-recent-messages + instead of (with-output-string (print-recent-messages ...)). + 2004-11-18 Daiki Ueno * riece.el (riece-submit-bug-report): New command. diff --git a/lisp/riece-emacs.el b/lisp/riece-emacs.el index 1cfddda..bd21b5e 100644 --- a/lisp/riece-emacs.el +++ b/lisp/riece-emacs.el @@ -103,6 +103,25 @@ (defalias 'riece-facep 'facep) +;;; stolen (and renamed) from emacsbug.el. +(defun riece-recent-messages (n) + "Return N most recent messages, most recent first. +If N is nil, all messages will be returned." + (let ((message-buf (get-buffer "*Messages*"))) + (if message-buf + (with-temp-buffer + (let (beg-pos end-pos) + (with-current-buffer message-buf + (setq end-pos (goto-char (point-max))) + (if n + (progn + (forward-line (- n)) + (setq beg-pos (point))) + (setq beg-pos (point-min)))) + (insert-buffer-substring message-buf beg-pos end-pos) + (reverse-region (point-min) (point-max)) + (buffer-string)))))) + (provide 'riece-emacs) ;;; riece-emacs.el ends here diff --git a/lisp/riece-xemacs.el b/lisp/riece-xemacs.el index 3c5cf43..71613f9 100644 --- a/lisp/riece-xemacs.el +++ b/lisp/riece-xemacs.el @@ -129,6 +129,12 @@ (add-text-properties start end (list prop value 'start-open t 'end-open t) object)) +(defun riece-recent-messages (n) + "Return N most recent messages, most recent first. +If N is nil, all messages will be returned." + (with-output-to-string + (print-recent-messages n))) + (provide 'riece-xemacs) ;;; riece-xemacs.el ends here diff --git a/lisp/riece.el b/lisp/riece.el index 5b70a34..4f646db 100644 --- a/lisp/riece.el +++ b/lisp/riece.el @@ -540,9 +540,7 @@ Instead, these commands are available: "Submit via mail a bug report on Riece." ;; This strange form ensures that (recent-keys) is the value before ;; the bug subject string is read. - (interactive (list (with-output-to-string - (print-recent-messages 20)) - (recent-keys))) + (interactive (list (riece-recent-messages 20) (recent-keys))) (require 'reporter) (let ((reporter-prompt-for-summary-p t)) (unless riece-debug @@ -597,8 +595,8 @@ are familiar with the debugger, to get a lisp back-trace.") "(closed server)")) (setq pointer (cdr pointer)))) ;; Insert recent keystrokes. - (insert "\n\n" - "Recent keystrokes:\n-----------------\n\n") + (insert "\n\nRecent keystrokes:\n" + "-----------------\n\n") (let ((before-keys (point))) (insert (key-description recent-keys)) (save-restriction @@ -608,7 +606,7 @@ are familiar with the debugger, to get a lisp back-trace.") (search-forward " " nil t) (insert "\n")))) ;; Insert recent minibuffer messages. - (insert "\nRecent messages (most recent first):\n" + (insert "\n\nRecent messages (most recent first):\n" "-----------------------------------\n" recent-messages))))