emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp window.el


From: Martin Rudalics
Subject: [Emacs-diffs] emacs/lisp window.el
Date: Fri, 12 Dec 2008 09:30:55 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Martin Rudalics <m061211>       08/12/12 09:30:55

Modified files:
        lisp           : window.el 

Log message:
        (fit-window-to-buffer): Return non-nil when height
        was orderly adjusted, nil otherwise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/window.el?cvsroot=emacs&r1=1.170&r2=1.171

Patches:
Index: window.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/window.el,v
retrieving revision 1.170
retrieving revision 1.171
diff -u -b -r1.170 -r1.171
--- window.el   11 Dec 2008 17:17:44 -0000      1.170
+++ window.el   12 Dec 2008 09:30:55 -0000      1.171
@@ -1294,7 +1294,7 @@
 
 (defun fit-window-to-buffer (&optional window max-height min-height)
   "Adjust height of WINDOW to display its buffer's contents exactly.
-WINDOW defaults to the selected window.  Return nil.
+WINDOW defaults to the selected window.
 Optional argument MAX-HEIGHT specifies the maximum height of the
 window and defaults to the maximum permissible height of a window
 on WINDOW's frame.
@@ -1303,12 +1303,15 @@
 Both, MAX-HEIGHT and MIN-HEIGHT are specified in lines and
 include the mode line and header line, if any.
 
+Return non-nil if height was orderly adjusted, nil otherwise.
+
 Caution: This function can delete WINDOW and/or other windows
 when their height shrinks to less than MIN-HEIGHT."
   (interactive)
   ;; Do all the work in WINDOW and its buffer and restore the selected
   ;; window and the current buffer when we're done.
-  (let ((old-buffer (current-buffer)))
+  (let ((old-buffer (current-buffer))
+       value)
     (with-selected-window (or window (setq window (selected-window)))
       (set-buffer (window-buffer))
       ;; Use `condition-case' to handle any fixed-size windows and other
@@ -1384,10 +1387,13 @@
                            (= desired-height (window-height))
                            (not (pos-visible-in-window-p end)))
                  (enlarge-window 1)
-                 (setq desired-height (1+ desired-height))))))
+                 (setq desired-height (1+ desired-height))))
+             ;; Return non-nil only if nothing "bad" happened.
+             (setq value t)))
        (error nil)))
     (when (buffer-live-p old-buffer)
-      (set-buffer old-buffer))))
+      (set-buffer old-buffer))
+    value))
 
 (defun window-safely-shrinkable-p (&optional window)
   "Return t if WINDOW can be shrunk without shrinking other windows.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]