Commit e90f8545 authored by Sam Steingold's avatar Sam Steingold
Browse files

* lisp/apropos.el (apropos-print): Now that `apropos-mode' inherits

from `special-mode', entering it makes the buffer read-only, so
call it only when everything has been already inserted.
* lisp/emacs-lisp/ert.el (ert--setup-results-buffer)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-timings): Ditto.
* lisp/emacs-lisp/package.el (package--list-packages): Ditto.
* lisp/play/solitaire.el (solitaire): Ditto.
parent a2ff2fc0
2011-02-02 Sam Steingold <sds@gnu.org>
* apropos.el (apropos-print): Now that `apropos-mode' inherits
from `special-mode', entering it makes the buffer read-only, so
call it only when everything has been already inserted.
* emacs-lisp/ert.el (ert--setup-results-buffer)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-timings): Ditto.
* emacs-lisp/package.el (package--list-packages): Ditto.
* play/solitaire.el (solitaire): Ditto.
2011-02-02 Chong Yidong <cyd@stupidchicken.com>
 
* progmodes/compile.el: Make all faces inherit.
......
......@@ -974,7 +974,6 @@ If non-nil TEXT is a string that will be printed as a heading."
(old-buffer (current-buffer))
symbol item)
(set-buffer standard-output)
(apropos-mode)
(if (display-mouse-p)
(insert
"If moving the mouse over text changes the text's color, "
......@@ -1066,7 +1065,7 @@ If non-nil TEXT is a string that will be printed as a heading."
(apropos-print-doc 4 'apropos-plist nil))
(set (make-local-variable 'truncate-partial-width-windows) t)
(set (make-local-variable 'truncate-lines) t)
(setq buffer-read-only t))))
(apropos-mode))))
(prog1 apropos-accumulator
(setq apropos-accumulator ()))) ; permit gc
......
......@@ -1874,11 +1874,9 @@ BUFFER-NAME, if non-nil, is the buffer name to use."
(unless buffer-name (setq buffer-name "*ert*"))
(let ((buffer (get-buffer-create buffer-name)))
(with-current-buffer buffer
(setq buffer-read-only t)
(let ((inhibit-read-only t))
(buffer-disable-undo)
(erase-buffer)
(ert-results-mode)
;; Erase buffer again in case switching out of the previous
;; mode inserted anything. (This happens e.g. when switching
;; from ert-results-mode to ert-results-mode when
......@@ -1897,8 +1895,9 @@ BUFFER-NAME, if non-nil, is the buffer name to use."
(ewoc-enter-last ewoc
(make-ert--ewoc-entry :test test :hidden-p t)))
(ert--results-update-ewoc-hf ert--results-ewoc ert--results-stats)
(goto-char (1- (point-max)))
buffer)))))
(goto-char (1- (point-max)))))
(ert-results-mode)
buffer)))
(defvar ert--selector-history nil
......@@ -2341,11 +2340,9 @@ To be used in the ERT results buffer."
(let ((backtrace (ert-test-result-with-condition-backtrace result))
(buffer (get-buffer-create "*ERT Backtrace*")))
(pop-to-buffer buffer)
(setq buffer-read-only t)
(let ((inhibit-read-only t))
(buffer-disable-undo)
(erase-buffer)
(ert-simple-view-mode)
;; Use unibyte because `debugger-setup-buffer' also does so.
(set-buffer-multibyte nil)
(setq truncate-lines t)
......@@ -2354,7 +2351,8 @@ To be used in the ERT results buffer."
(goto-char (point-min))
(insert "Backtrace for test `")
(ert-insert-test-name-button (ert-test-name test))
(insert "':\n")))))))
(insert "':\n")
(ert-simple-view-mode)))))))
(defun ert-results-pop-to-messages-for-test-at-point ()
"Display the part of the *Messages* buffer generated during the test at point.
......@@ -2367,16 +2365,15 @@ To be used in the ERT results buffer."
(result (aref (ert--stats-test-results stats) pos)))
(let ((buffer (get-buffer-create "*ERT Messages*")))
(pop-to-buffer buffer)
(setq buffer-read-only t)
(let ((inhibit-read-only t))
(buffer-disable-undo)
(erase-buffer)
(ert-simple-view-mode)
(insert (ert-test-result-messages result))
(goto-char (point-min))
(insert "Messages for test `")
(ert-insert-test-name-button (ert-test-name test))
(insert "':\n")))))
(insert "':\n")
(ert-simple-view-mode)))))
(defun ert-results-pop-to-should-forms-for-test-at-point ()
"Display the list of `should' forms executed during the test at point.
......@@ -2389,11 +2386,9 @@ To be used in the ERT results buffer."
(result (aref (ert--stats-test-results stats) pos)))
(let ((buffer (get-buffer-create "*ERT list of should forms*")))
(pop-to-buffer buffer)
(setq buffer-read-only t)
(let ((inhibit-read-only t))
(buffer-disable-undo)
(erase-buffer)
(ert-simple-view-mode)
(if (null (ert-test-result-should-forms result))
(insert "\n(No should forms during this test.)\n")
(loop for form-description in (ert-test-result-should-forms result)
......@@ -2411,7 +2406,8 @@ To be used in the ERT results buffer."
(insert (concat "(Values are shallow copies and may have "
"looked different during the test if they\n"
"have been modified destructively.)\n"))
(forward-line 1)))))
(forward-line 1)
(ert-simple-view-mode)))))
(defun ert-results-toggle-printer-limits-for-test-at-point ()
"Toggle how much of the condition to print for the test at point.
......@@ -2443,11 +2439,9 @@ To be used in the ERT results buffer."
(setq data (sort data (lambda (a b)
(> (second a) (second b)))))
(pop-to-buffer buffer)
(setq buffer-read-only t)
(let ((inhibit-read-only t))
(buffer-disable-undo)
(erase-buffer)
(ert-simple-view-mode)
(if (null data)
(insert "(No data)\n")
(insert (format "%-3s %8s %8s\n" "" "time" "cumul"))
......@@ -2460,7 +2454,8 @@ To be used in the ERT results buffer."
(insert "\n"))))
(goto-char (point-min))
(insert "Tests by run time (seconds):\n\n")
(forward-line 1))))
(forward-line 1)
(ert-simple-view-mode))))
;;;###autoload
(defun ert-describe-test (test-or-test-name)
......
......@@ -1658,10 +1658,10 @@ list; the default is to display everything in `package-alist'."
(require 'finder-inf nil t)
(let ((buf (get-buffer-create "*Packages*")))
(with-current-buffer buf
(package-menu-mode)
(set (make-local-variable 'package-menu-package-list) packages)
(set (make-local-variable 'package-menu-sort-key) nil)
(package--generate-package-list))
(package--generate-package-list)
(package-menu-mode))
;; The package menu buffer has keybindings. If the user types
;; `M-x list-packages', that suggests it should become current.
(switch-to-buffer buf)))
......
......@@ -188,7 +188,6 @@ Pick your favourite shortcuts:
(interactive "P")
(switch-to-buffer "*Solitaire*")
(solitaire-mode)
(setq buffer-read-only t)
(setq solitaire-stones 32)
(solitaire-insert-board)
......@@ -196,7 +195,7 @@ Pick your favourite shortcuts:
(goto-char (point-max))
(setq solitaire-center (search-backward "."))
(setq buffer-undo-list (list (point)))
(set-buffer-modified-p nil))
(solitaire-mode))
(defun solitaire-build-modeline ()
(setq mode-line-format
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment