]> code.delx.au - gnu-emacs/blobdiff - lisp/help.el
Auto-commit of generated files.
[gnu-emacs] / lisp / help.el
index da11389d87cf42cbcb2998de48f5a44e828e19d2..25bc9c4b7c625c430f93c44d5afcb084f3b5028b 100644 (file)
@@ -1,6 +1,7 @@
 ;;; help.el --- help commands for Emacs
 
-;; Copyright (C) 1985-1986, 1993-1994, 1998-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1993-1994, 1998-2013 Free Software
+;; Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: help, internal
@@ -411,7 +412,9 @@ With argument, display info only for the selected version."
 The number of messages retained in that buffer
 is specified by the variable `message-log-max'."
   (interactive)
-  (switch-to-buffer (get-buffer-create "*Messages*")))
+  (with-current-buffer (get-buffer-create "*Messages*")
+    (goto-char (point-max))
+    (display-buffer (current-buffer))))
 
 (defun view-order-manuals ()
   "Display the Emacs ORDERS file."
@@ -979,16 +982,7 @@ buffer, and should return a positive integer.  At the time the
 function is called, the window to be resized is selected."
   :type '(choice integer function)
   :group 'help
-  :version "24.2")
-
-(defcustom temp-buffer-resize-frames nil
-  "Non-nil means `temp-buffer-resize-mode' can resize frames.
-A frame can be resized if and only if its root window is a live
-window.  The height of the root window is subject to the values of
-`temp-buffer-max-height' and `window-min-height'."
-  :type 'boolean
-  :version "24.2"
-  :group 'help)
+  :version "24.3")
 
 (define-minor-mode temp-buffer-resize-mode
   "Toggle auto-resizing temporary buffer windows (Temp Buffer Resize Mode).
@@ -1001,6 +995,11 @@ show a temporary buffer are automatically resized in height to
 fit the buffer's contents, but never more than
 `temp-buffer-max-height' nor less than `window-min-height'.
 
+A window is resized only if it has been specially created for the
+buffer.  Windows that have shown another buffer before are not
+resized.  A frame is resized only if `fit-frame-to-buffer' is
+non-nil.
+
 This mode is used by `help', `apropos' and `completion' buffers,
 and some others."
   :global t :group 'help
@@ -1016,28 +1015,30 @@ WINDOW can be any live window and defaults to the selected one.
 
 Do not make WINDOW higher than `temp-buffer-max-height' nor
 smaller than `window-min-height'.  Do nothing if WINDOW is not
-vertically combined or some of its contents are scrolled out of
-view."
+vertically combined, some of its contents are scrolled out of
+view, or WINDOW was not created by `display-buffer'."
   (setq window (window-normalize-window window t))
-  (let ((height (if (functionp temp-buffer-max-height)
-                   (with-selected-window window
-                     (funcall temp-buffer-max-height (window-buffer)))
-                 temp-buffer-max-height)))
-    (cond
-     ((and (pos-visible-in-window-p (point-min) window)
-          (window-combined-p window))
-      (fit-window-to-buffer window height))
-     ((and temp-buffer-resize-frames
-          (eq window (frame-root-window window))
-          (memq (car (window-parameter window 'quit-restore))
-                ;; If 'same is too strong, we might additionally check
-                ;; whether the second element is 'frame.
-                '(same frame)))
-      (let ((frame (window-frame window)))
-       (fit-frame-to-buffer
-        frame (+ (frame-height frame)
-                 (- (window-total-size window))
-                 height)))))))
+  (let ((buffer-name (buffer-name (window-buffer window))))
+    (let ((height (if (functionp temp-buffer-max-height)
+                     (with-selected-window window
+                       (funcall temp-buffer-max-height (window-buffer)))
+                   temp-buffer-max-height))
+         (quit-cadr (cadr (window-parameter window 'quit-restore))))
+      (cond
+       ;; Resize WINDOW iff it was split off by `display-buffer'.
+       ((and (eq quit-cadr 'window)
+            (pos-visible-in-window-p (point-min) window)
+            (window-combined-p window))
+       (fit-window-to-buffer window height))
+       ;; Resize FRAME iff it was created by `display-buffer'.
+       ((and fit-frame-to-buffer
+            (eq quit-cadr 'frame)
+            (eq window (frame-root-window window)))
+       (let ((frame (window-frame window)))
+         (fit-frame-to-buffer
+          frame (+ (frame-height frame)
+                   (- (window-total-size window))
+                   height))))))))
 
 ;;; Help windows.
 (defcustom help-window-select 'other