Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
d7e78187
Commit
d7e78187
authored
Dec 11, 2008
by
Martin Rudalics
Browse files
(dired-pop-to-buffer): Use fit-window-to-buffer when
dired-shrink-to-fit is non-nil. (Bug#1488)
parent
011a0143
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
37 deletions
+3
-37
lisp/dired.el
lisp/dired.el
+3
-37
No files found.
lisp/dired.el
View file @
d7e78187
...
@@ -2678,44 +2678,10 @@ name, or the marker and a count of marked files."
...
@@ -2678,44 +2678,10 @@ name, or the marker and a count of marked files."
(defun dired-pop-to-buffer (buf)
(defun dired-pop-to-buffer (buf)
;; Pop up 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))
(pop-to-buffer (get-buffer-create buf))
;; let window shrink to fit:
;; If dired-shrink-to-fit is t, make its window fit its contents.
(let ((window (selected-window))
(when dired-shrink-to-fit
target-lines w2)
(fit-window-to-buffer (get-buffer-window buf))))
(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)
)))
(defcustom dired-no-confirm nil
(defcustom dired-no-confirm nil
"A list of symbols for commands Dired should not confirm.
"A list of symbols for commands Dired should not confirm.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment