[Top][All Lists]

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

change behavior of dired-simultaneous-find-file

From: Thierry Volpiatto
Subject: change behavior of dired-simultaneous-find-file
Date: Sun, 20 Jun 2010 09:33:51 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

Hi, when hitting F in dired, if too much files are marked, an error

| Too many files to visit simultaneously.  Try C-u prefix.

Why instead of that not opening files in background as suggested by this
error message?

So no error message, if window is too small use find-file-noselect else
do what expected, split window.


(defun dired-simultaneous-find-file (file-list noselect)

  "Visit all files in FILE-LIST and display them simultaneously.
The current window is split across all files in FILE-LIST, as evenly as
possible.  Remaining lines go to the bottom-most window.  The number of
files that can be displayed this way is restricted by the height of the
current window and the variable `window-min-height'.  With non-nil
NOSELECT the files are merely found but not selected."

  ;; We don't make this function interactive because it is usually too clumsy
  ;; to specify FILE-LIST interactively unless via dired.
  ;; Calculate and check window size.
  (let ((size (/ (window-height) (length file-list))))
    (if (or noselect (>= window-min-height size))
        ;; Do not select the buffer.
        (loop for f in file-list do (find-file-noselect f))
        ;; We will have to select the buffer.
        ;; Vertically split off a window of desired size.  Upper window will
        ;; have SIZE lines.  Select lower (larger) window.  We split it again.
        (find-file (car file-list))
        (loop for f in (cdr file-list)
           do (progn
                (select-window (split-window nil size))
                (find-file f))))))

Thierry Volpiatto
Gpg key: http://pgp.mit.edu/

reply via email to

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