From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.help Subject: Re: icons for filetype in dired Date: Sun, 25 Nov 2007 23:35:39 +0200 Organization: JURTA Message-ID: <87r6ieatzo.fsf@jurta.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1196031127 24382 80.91.229.12 (25 Nov 2007 22:52:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Nov 2007 22:52:07 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Nov 25 23:52:13 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IwQKi-0005dN-5j for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Nov 2007 23:52:12 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IwQKT-0005i6-EF for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Nov 2007 17:51:57 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!syros.belnet.be!news.belnet.be!feeder.news-service.com!border1.nntp.ams.giganews.com!nntp.giganews.com!uio.no!quimby.gnus.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 34 Original-NNTP-Posting-Host: mdu-243.232.170.83.sovam.net.ua Original-X-Trace: quimby.gnus.org 1196026535 28602 83.170.232.243 (25 Nov 2007 21:35:35 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: Sun, 25 Nov 2007 21:35:35 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) Cancel-Lock: sha1:VqUL4DM2cRplMsBzycCAgV0JkqM= Original-Xref: shelby.stanford.edu gnu.emacs.help:154086 X-Mailman-Approved-At: Sun, 25 Nov 2007 17:51:43 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:49522 Archived-At: > is there a chance to get icons into each line in a dired > buffer according to the filetype. Something like > http://www.netlaputa.ne.jp/~kose/Emacs/iimage.html ,but with > small icons!? > If it is not too slow, it would be realy helpful :-) (defun dired-insert-file-icons () "Insert icons before file names in the dired buffer." (interactive) (dired-map-dired-file-lines (lambda (file) (let* ((image-pos (dired-move-to-filename)) (mime-type (mailcap-extension-to-mime (file-name-extension file t))) (icon-file (if mime-type (concat "/usr/share/icons/kdeclassic/16x16/mimetypes/" mime-type))) overlay) (unless (and icon-file (file-exists-p icon-file)) ;; default icon (setq icon-file "/usr/share/icons/kdeclassic/16x16/mimetypes/empty.png")) (unless (delq nil (mapcar (lambda (o) (overlay-get o 'put-image)) (overlays-in (point) (1+ (point))))) (put-image (create-image icon-file) image-pos) (setq overlay (car (delq nil (mapcar (lambda (o) (and (overlay-get o 'put-image) o)) (overlays-in (point) (1+ (point))))))) (overlay-put overlay 'file file) (overlay-put overlay 'icon-file icon-file)))))) (add-hook 'dired-after-readin-hook 'dired-insert-file-icons) -- Juri Linkov http://www.jurta.org/emacs/