From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: thumbs-image-type? Date: Sun, 23 Oct 2005 23:58:50 +0200 Message-ID: References: <7192.1129593214@olgas.newt.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1130104841 6175 80.91.229.2 (23 Oct 2005 22:00:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 23 Oct 2005 22:00:41 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 24 00:00:39 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ETnsl-0006ot-Kv for ged-emacs-devel@m.gmane.org; Sun, 23 Oct 2005 23:59:59 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ETnsl-0005Y3-1i for ged-emacs-devel@m.gmane.org; Sun, 23 Oct 2005 17:59:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ETnsZ-0005Xj-Vn for emacs-devel@gnu.org; Sun, 23 Oct 2005 17:59:48 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ETnsY-0005XW-IQ for emacs-devel@gnu.org; Sun, 23 Oct 2005 17:59:47 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ETnsY-0005XT-Bw for emacs-devel@gnu.org; Sun, 23 Oct 2005 17:59:46 -0400 Original-Received: from [195.41.46.237] (helo=pfepc.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ETnsY-0006nV-LZ for emacs-devel@gnu.org; Sun, 23 Oct 2005 17:59:46 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepc.post.tele.dk (Postfix) with SMTP id 1DD40262808; Sun, 23 Oct 2005 23:59:41 +0200 (CEST) Original-To: Bill Wohler In-Reply-To: <7192.1129593214@olgas.newt.com> (Bill Wohler's message of "Mon, 17 Oct 2005 16:53:34 -0700") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:44648 Archived-At: Bill Wohler writes: > It seems to me that the following should be renamed to image-type and > moved to image.el, or--probably better--calls to thumbs-image-type > should be replaced by image-type-from-file-header. > > (defun thumbs-image-type (img) > "Return image type from filename IMG." > (cond ((string-match ".*\\.jpe?g\\'" img) 'jpeg) > ((string-match ".*\\.xpm\\'" img) 'xpm) > ((string-match ".*\\.xbm\\'" img) 'xbm) > ((string-match ".*\\.gif\\'" img) 'gif) > ((string-match ".*\\.bmp\\'" img) 'bmp) > ((string-match ".*\\.png\\'" img) 'png) > ((string-match ".*\\.tiff?\\'" img) 'tiff))) I have added image-type-from-file-name to image.el. I also added image-type-from-buffer inspired by the function mm-image-type-from-buffer in mm-decode.el, and used it to simplify image-file-from-file-header. -- Kim F. Storm http://www.cua.dk