* riece-xemacs.el (riece-recent-messages): New function.
authorDaiki Ueno <ueno@unixuser.org>
Fri, 19 Nov 2004 08:04:55 +0000 (08:04 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Fri, 19 Nov 2004 08:04:55 +0000 (08:04 +0000)
* 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 ...)).

lisp/ChangeLog
lisp/riece-emacs.el
lisp/riece-xemacs.el
lisp/riece.el

index d987f45..1460097 100644 (file)
@@ -1,3 +1,10 @@
+2004-11-19  Daiki Ueno  <ueno@unixuser.org>
+
+       * 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  <ueno@unixuser.org>
 
        * riece.el (riece-submit-bug-report): New command.
index 1cfddda..bd21b5e 100644 (file)
 
 (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
index 3c5cf43..71613f9 100644 (file)
   (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
index 5b70a34..4f646db 100644 (file)
@@ -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))))