1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-31 20:02:42 +00:00

(dired-format-columns-of-files): Use completion--insert-strings.

This commit is contained in:
Stefan Monnier 2008-05-02 17:39:02 +00:00
parent e5b5b82d4e
commit 991ae4e4f8
2 changed files with 4 additions and 25 deletions

View File

@ -5,6 +5,7 @@
* dired.el (dired-read-dir-and-switches):
Set minibuffer-completing-file-name and call substitute-in-file-name.
(dired-format-columns-of-files): Use completion--insert-strings.
* minibuffer.el (completion-hilit-commonality): Revert last change:
the leftover code was actually useful.

View File

@ -2708,31 +2708,9 @@ just the current file."
(apply function args))))
(defun dired-format-columns-of-files (files)
;; Files should be in forward order for this loop.
;; i.e., (car files) = first file in buffer.
;; Returns the number of lines used.
(let* ((maxlen (+ 2 (apply 'max (mapcar 'length files))))
(width (- (window-width (selected-window)) 2))
(columns (max 1 (/ width maxlen)))
(nfiles (length files))
(rows (+ (/ nfiles columns)
(if (zerop (% nfiles columns)) 0 1)))
(i 0)
(j 0))
(setq files (nconc (copy-sequence files) ; fill up with empty fns
(make-list (- (* columns rows) nfiles) "")))
(setcdr (nthcdr (1- (length files)) files) files) ; make circular
(while (< j rows)
(while (< i columns)
(indent-to (* i maxlen))
(insert (car files))
(setq files (nthcdr rows files)
i (1+ i)))
(insert "\n")
(setq i 0
j (1+ j)
files (cdr files)))
rows))
(let ((beg (point)))
(completion--insert-strings files)
(put-text-property beg (point) 'mouse-face nil)))
;; Commands to mark or flag file(s) at or near current line.