* icons for filetype in dired
@ 2007-11-25 15:16 Fabian Braennstroem
2007-11-25 21:35 ` Juri Linkov
0 siblings, 1 reply; 3+ messages in thread
From: Fabian Braennstroem @ 2007-11-25 15:16 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
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 :-)
Regards!
Fabian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: icons for filetype in dired
2007-11-25 15:16 icons for filetype in dired Fabian Braennstroem
@ 2007-11-25 21:35 ` Juri Linkov
2007-11-27 23:01 ` Fabian Braennstroem
0 siblings, 1 reply; 3+ messages in thread
From: Juri Linkov @ 2007-11-25 21:35 UTC (permalink / raw)
To: help-gnu-emacs
> 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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: icons for filetype in dired
2007-11-25 21:35 ` Juri Linkov
@ 2007-11-27 23:01 ` Fabian Braennstroem
0 siblings, 0 replies; 3+ messages in thread
From: Fabian Braennstroem @ 2007-11-27 23:01 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-11-27 23:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-25 15:16 icons for filetype in dired Fabian Braennstroem
2007-11-25 21:35 ` Juri Linkov
2007-11-27 23:01 ` Fabian Braennstroem
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.