From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Fabian Braennstroem Newsgroups: gmane.emacs.help Subject: Re: icons for filetype in dired Date: Tue, 27 Nov 2007 23:01:00 +0000 Organization: FernUni Hagen Message-ID: References: <87r6ieatzo.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1196203250 32469 80.91.229.12 (27 Nov 2007 22:40:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 27 Nov 2007 22:40:50 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 27 23:40:55 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 1Ix96k-0004JE-Vp for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Nov 2007 23:40:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ix96V-0002Wi-OO for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Nov 2007 17:40:31 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-fra1.dfn.de!news-koe1.dfn.de!tamarack.fernuni-hagen.de!news.fernuni-hagen.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 42 Original-NNTP-Posting-Host: pd9e48390.dip0.t-ipconnect.de Original-X-Trace: tamarack.fernuni-hagen.de 1196200633 25396 217.228.131.144 (27 Nov 2007 21:57:13 GMT) Original-X-Complaints-To: newsadmin@fernuni-hagen.de Original-NNTP-Posting-Date: Tue, 27 Nov 2007 21:57:13 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.0 In-Reply-To: <87r6ieatzo.fsf@jurta.org> Original-Xref: shelby.stanford.edu gnu.emacs.help:154173 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:49597 Archived-At: Hi Juri, Juri Linkov schrieb am 11/25/2007 09:35 PM: >> 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) Thanks! Looks great, but my emacs version 22.1 says: let*: Symbol's function definition is void: mailcap-extension-to-mime is it a cvs function or did I forgot anything important!? Fabian