emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp dired.el


From: Martin Rudalics
Subject: [Emacs-diffs] emacs/lisp dired.el
Date: Thu, 11 Dec 2008 09:48:08 +0000

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

Modified files:
        lisp           : dired.el 

Log message:
        (dired-pop-to-buffer): Use fit-window-to-buffer when
        dired-shrink-to-fit is non-nil.  (Bug#1488)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/dired.el?cvsroot=emacs&r1=1.415&r2=1.416

Patches:
Index: dired.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/dired.el,v
retrieving revision 1.415
retrieving revision 1.416
diff -u -b -r1.415 -r1.416
--- dired.el    5 Dec 2008 13:36:49 -0000       1.415
+++ dired.el    11 Dec 2008 09:48:08 -0000      1.416
@@ -2678,44 +2678,10 @@
 
 (defun dired-pop-to-buffer (buf)
   ;; Pop up buffer BUF.
-  ;; If dired-shrink-to-fit is t, make its window fit its contents.
-  (if (not dired-shrink-to-fit)
       (pop-to-buffer (get-buffer-create buf))
-    ;; let window shrink to fit:
-    (let ((window (selected-window))
-         target-lines w2)
-      (cond ;; if split-height-threshold is enabled, use the largest window
-            ((and (> (window-height (setq w2 (get-largest-window)))
-                    split-height-threshold)
-                 (window-full-width-p w2))
-            (setq window w2))
-           ;; if the least-recently-used window is big enough, use it
-           ((and (> (window-height (setq w2 (get-lru-window)))
-                    (* 2 window-min-height))
-                 (window-full-width-p w2))
-            (setq window w2)))
-      (save-excursion
-       (set-buffer buf)
-       (goto-char (point-max))
-       (skip-chars-backward "\n\r\t ")
-       (setq target-lines (count-lines (point-min) (point)))
-       ;; Don't forget to count the last line.
-       (if (not (bolp))
-           (setq target-lines (1+ target-lines))))
-      (if (<= (window-height window) (* 2 window-min-height))
-         ;; At this point, every window on the frame is too small to split.
-         (setq w2 (display-buffer buf))
-       (setq w2 (split-window window
-                 (max window-min-height
-                      (- (window-height window)
-                         (1+ (max window-min-height target-lines)))))))
-      (set-window-buffer w2 buf)
-      (if (< (1- (window-height w2)) target-lines)
-         (progn
-           (select-window w2)
-           (enlarge-window (- target-lines (1- (window-height w2))))))
-      (set-window-start w2 1)
-      )))
+  ;; If dired-shrink-to-fit is t, make its window fit its contents.
+  (when dired-shrink-to-fit
+    (fit-window-to-buffer (get-buffer-window buf))))
 
 (defcustom dired-no-confirm nil
   "A list of symbols for commands Dired should not confirm.




reply via email to

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