changeset 94562:46f178f2b009

(dired-format-columns-of-files): Use completion--insert-strings.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 02 May 2008 17:39:02 +0000
parents bbc1b1a5633e
children a0bb8ca25a33
files lisp/ChangeLog lisp/dired.el
diffstat 2 files changed, 4 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri May 02 17:32:51 2008 +0000
+++ b/lisp/ChangeLog	Fri May 02 17:39:02 2008 +0000
@@ -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.
--- a/lisp/dired.el	Fri May 02 17:32:51 2008 +0000
+++ b/lisp/dired.el	Fri May 02 17:39:02 2008 +0000
@@ -2708,31 +2708,9 @@
       (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.