From: Stefan Monnier Date: Fri, 2 May 2008 17:39:02 +0000 (+0000) Subject: (dired-format-columns-of-files): Use completion--insert-strings. X-Git-Tag: emacs-pretest-23.0.90~5869 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=991ae4e4f8e8cefd2a83e7ffb4148d358c750486;p=emacs.git (dired-format-columns-of-files): Use completion--insert-strings. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6405f47dece..1177b89449a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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. diff --git a/lisp/dired.el b/lisp/dired.el index a2f0f009d33..51dc58167b5 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -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.