** `initial-buffer-choice' can now specify a function to set up the
initial buffer.
+** The *Messages* buffer is created in a new major mode `messages-buffer-mode',
+and read-only. Code that might create the *Messages* buffer should
+call the function `messages-buffer' to do so and set the mode.
+
** `remember-notes' creates a buffer whose content is saved on kill-emacs.
You may think of it as a *scratch* buffer whose content is preserved.
In fact, it was designed as a replacement for *scratch* buffer and can
+2013-09-17 Glenn Morris <rgm@gnu.org>
+
+ * simple.el (messages-buffer-mode): New major mode.
+ (messages-buffer): New function.
+ * startup.el (normal-top-level): Switch mode of *Messages* buffer.
+ * emacs-lisp/ert.el (ert--force-message-log-buffer-truncation)
+ (ert-run-test): Use `message-buffer' function.
+ (ert--force-message-log-buffer-truncation): Ignore read-only.
+ * help.el (view-echo-area-messages): Use `message-buffer' function.
+ * mail/emacsbug.el (report-emacs-bug): Use `message-buffer' function.
+
2013-09-17 Stefan Monnier <monnier@iro.umontreal.ca>
* subr.el (eval-after-load): Preserve evaluation order (bug#15389).
"Immediately truncate *Messages* buffer according to `message-log-max'.
This can be useful after reducing the value of `message-log-max'."
- (with-current-buffer (get-buffer-create "*Messages*")
+ (with-current-buffer (messages-buffer)
;; This is a reimplementation of this part of message_dolog() in xdisp.c:
;; if (NATNUMP (Vmessage_log_max))
;; {
(end (save-excursion
(goto-char (point-max))
(forward-line (- message-log-max))
- (point))))
+ (point)))
+ (inhibit-read-only t))
(delete-region begin end)))))
(defvar ert--running-tests nil
(setf (ert-test-most-recent-result ert-test) nil)
(cl-block error
(let ((begin-marker
- (with-current-buffer (get-buffer-create "*Messages*")
+ (with-current-buffer (messages-buffer)
(point-max-marker))))
(unwind-protect
(let ((info (make-ert--test-execution-info
(ert--run-test-internal info))
(let ((result (ert--test-execution-info-result info)))
(setf (ert-test-result-messages result)
- (with-current-buffer (get-buffer-create "*Messages*")
+ (with-current-buffer (messages-buffer)
(buffer-substring begin-marker (point-max))))
(ert--force-message-log-buffer-truncation)
(setq should-form-accu (nreverse should-form-accu))
+2013-09-17 Glenn Morris <rgm@gnu.org>
+
+ * gnus-util.el (gnus-message-with-timestamp-1):
+ Use `message-buffer' function if available. Ignore read-only.
+
2013-09-16 Katsumi Yamaoka <yamaoka@jpl.org>
* message.el (message-expand-group, message-completion-in-region):
(> message-log-max 0)
(/= (length str) 0))
(setq time (current-time))
- (with-current-buffer (get-buffer-create "*Messages*")
+ (with-current-buffer (if (fboundp 'messages-buffer)
+ (messages-buffer)
+ (get-buffer-create "*Messages*"))
(goto-char (point-max))
- (insert ,timestamp str "\n")
- (forward-line (- message-log-max))
- (delete-region (point-min) (point))
+ (let ((inhibit-read-only t))
+ (insert ,timestamp str "\n")
+ (forward-line (- message-log-max))
+ (delete-region (point-min) (point)))
(goto-char (point-max))))
str)
(gnus-add-timestamp-to-message
;;; help.el --- help commands for Emacs
-;; Copyright (C) 1985-1986, 1993-1994, 1998-2013 Free Software
-;; Foundation, Inc.
+;; Copyright (C) 1985-1986, 1993-1994, 1998-2013 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: help, internal
The number of messages retained in that buffer
is specified by the variable `message-log-max'."
(interactive)
- (with-current-buffer (get-buffer-create "*Messages*")
+ (with-current-buffer (messages-buffer)
(goto-char (point-max))
(display-buffer (current-buffer))))
;;; emacsbug.el --- command to report Emacs bugs to appropriate mailing list
-;; Copyright (C) 1985, 1994, 1997-1998, 2000-2013 Free Software
-;; Foundation, Inc.
+;; Copyright (C) 1985, 1994, 1997-1998, 2000-2013
+;; Free Software Foundation, Inc.
;; Author: K. Shane Hartman
;; Maintainer: FSF
(report-emacs-bug-can-use-osx-open)))
user-point message-end-point)
(setq message-end-point
- (with-current-buffer (get-buffer-create "*Messages*")
+ (with-current-buffer (messages-buffer)
(point-max-marker)))
(compose-mail report-emacs-bug-address topic)
;; The rest of this does not execute if the user was asked to
buffer-invisibility-spec)
(setq buffer-invisibility-spec nil)))
\f
+(define-derived-mode messages-buffer-mode special-mode "Messages"
+ "Major mode used in the \"*Messages*\" buffer.")
+
+(defun messages-buffer ()
+ "Return the \"*Messages*\" buffer.
+If it does not exist, create and it switch it to `messages-buffer-mode'."
+ (or (get-buffer "*Messages*")
+ (with-current-buffer (get-buffer-create "*Messages*")
+ (messages-buffer-mode)
+ (current-buffer))))
+
+\f
;; Minibuffer prompt stuff.
;;(defun minibuffer-prompt-modification (start end)
;;; startup.el --- process Emacs shell arguments -*- lexical-binding: t -*-
-;; Copyright (C) 1985-1986, 1992, 1994-2013 Free Software Foundation,
-;; Inc.
+;; Copyright (C) 1985-1986, 1992, 1994-2013 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: internal
(setq command-line-processed t)
(let ((dir default-directory))
(with-current-buffer "*Messages*"
+ (messages-buffer-mode)
;; Make it easy to do like "tail -f".
(set (make-local-variable 'window-point-insertion-type) t)
;; Give *Messages* the same default-directory as *scratch*,
+2013-09-17 Glenn Morris <rgm@gnu.org>
+
+ * xdisp.c (message_dolog): If we create *Messages*,
+ switch it to messages-buffer-mode.
+
2013-09-17 Paul Eggert <eggert@cs.ucla.edu>
Don't overuse 'const' in types of locals.
/* Display generation from window structure and buffer text.
-Copyright (C) 1985-1988, 1993-1995, 1997-2013 Free Software Foundation,
-Inc.
+Copyright (C) 1985-1988, 1993-1995, 1997-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
old_deactivate_mark = Vdeactivate_mark;
oldbuf = current_buffer;
- Fset_buffer (Fget_buffer_create (Vmessages_buffer_name));
+
+ /* Ensure the Messages buffer exists, and switch to it.
+ If we created it, set the major-mode. */
+ {
+ int newbuffer = 0;
+ if (NILP (Fget_buffer (Vmessages_buffer_name))) newbuffer = 1;
+
+ Fset_buffer (Fget_buffer_create (Vmessages_buffer_name));
+
+ if (newbuffer &&
+ !NILP (Ffboundp (intern ("messages-buffer-mode"))))
+ call0 (intern ("messages-buffer-mode"));
+ }
+
bset_undo_list (current_buffer, Qt);
oldpoint = message_dolog_marker1;