From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix Date: Sun, 28 Aug 2016 21:26:23 +0900 (JST) Message-ID: References: <83d1kud3m1.fsf@gnu.org> <83a8fyd1x0.fsf@gnu.org> <87oa4e1raw.fsf@zigzag.favinet> <838tvicuy3.fsf@gnu.org> <837fb2cqx1.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1472387241 18581 195.159.176.226 (28 Aug 2016 12:27:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 28 Aug 2016 12:27:21 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: ttn@gnu.org, 24317@debbugs.gnu.org, schwab@linux-m68k.org, Tino Calancha To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 28 14:27:17 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bdzBD-0004Ho-LZ for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Aug 2016 14:27:15 +0200 Original-Received: from localhost ([::1]:39276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdzBB-0001Yd-7S for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Aug 2016 08:27:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdzB4-0001YW-Nf for bug-gnu-emacs@gnu.org; Sun, 28 Aug 2016 08:27:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bdzB0-0002aR-HE for bug-gnu-emacs@gnu.org; Sun, 28 Aug 2016 08:27:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44879) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdzB0-0002aM-Dr for bug-gnu-emacs@gnu.org; Sun, 28 Aug 2016 08:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bdzB0-00028J-6j for bug-gnu-emacs@gnu.org; Sun, 28 Aug 2016 08:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Aug 2016 12:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24317 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24317-submit@debbugs.gnu.org id=B24317.14723871958163 (code B ref 24317); Sun, 28 Aug 2016 12:27:02 +0000 Original-Received: (at 24317) by debbugs.gnu.org; 28 Aug 2016 12:26:35 +0000 Original-Received: from localhost ([127.0.0.1]:42591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bdzAZ-00027b-L1 for submit@debbugs.gnu.org; Sun, 28 Aug 2016 08:26:35 -0400 Original-Received: from mail-pf0-f193.google.com ([209.85.192.193]:34172) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bdzAY-00027M-1h for 24317@debbugs.gnu.org; Sun, 28 Aug 2016 08:26:34 -0400 Original-Received: by mail-pf0-f193.google.com with SMTP id g202so7636421pfb.1 for <24317@debbugs.gnu.org>; Sun, 28 Aug 2016 05:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=cu5TPxXJ3cN0y4IofXJT8EH4oHtXK+3lkf+Y0uZfvi0=; b=0o06x4zFtqS5SBLzEw/ke4OJWmKkkUVtZgikJvoUiQwOy5jG9hWIucZvw+udFkFRUX UicVX3YCs/vsrcI5HF34XbP4imRDi6NzLBknSo7xvkpapL0PLcU2oq1xvXsKBai19yt0 SpXVEAziiny/r3Q1uiJ/cb6nju7scNihN82E02hMEWdTAa3G4cCKLp38DNI94Y0In4bG yKRzpmcSZKo8QTSQXHcQ+rL5dUwd43ltv1YEHLFXncqUqVkBO8V5chQVhK9fMZRLP0Xk k9Ls6BngllxRLCuF74MjFE4T+FKGAmVz5am7cIZbeoitbsdH5t8hTlyuLl1IpOV8Xr4F IyzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=cu5TPxXJ3cN0y4IofXJT8EH4oHtXK+3lkf+Y0uZfvi0=; b=lhFswToEj6zh+fbTv8GpR8kVbu71KxvqWBQh8v3VChcGpNkg3PZjDXz2LEx13V+iCe ZpfYNQMB8XNuUm3wvzNf5187uqc2SP8deLHW+WeK0fPLOaQWFA/jZm6hIzbq7Y/UrQTW 8VOE3GOEKlQkiLrF9LMdxbO1EJsqjnFRUPu8LeBR0o+5Z3/M/IhmzfTwpDXpn87UnhLN nPyUNqfpTYtZQ8ZNGBIEGZLY4W0eTGsZ0i8eTZ7vGPzxIoQLcHwdzfzBxWvKdpJ4wsvq U6faokW1aMNZdiJ5Y4oxIh2ab1nVxZeDD+W5qut0WHHdyXMi5FFuUN93LDPBM8eLMx8F JI+w== X-Gm-Message-State: AE9vXwMKYGR985T7oC8QgqVmS1faEVYpCioLYB4cfWJSpnLofAeaV5v28LglFHQjLzqXDw== X-Received: by 10.98.63.1 with SMTP id m1mr22905845pfa.14.1472387188196; Sun, 28 Aug 2016 05:26:28 -0700 (PDT) Original-Received: from calancha-pc ([103.5.140.164]) by smtp.gmail.com with ESMTPSA id tm1sm41854892pac.23.2016.08.28.05.26.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Aug 2016 05:26:27 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: <837fb2cqx1.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:122739 Archived-At: On Sat, 27 Aug 2016, Eli Zaretskii wrote: > I think we should indeed use image-type instead of having yet another > function that recognizes JPEG. The problem I pointed out should be > fixed in image-type-from-file-name, regardless. I see. I have prepared following new patch: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From b953d600a295e4e0aa58b85126296663e7f02472 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Sun, 28 Aug 2016 21:20:22 +0900 Subject: [PATCH] image-type-from-file-name: Perform a case insensitive match Fix Bug#24317 * lisp/image.el (image-type-from-file-name): Bind case-fold-search to a non-nil value to force a case insensitive match. * lisp/image-dired.el (image-dired-rotate-original): Use image-type (Bug#24317). (image-dired-get-exif-file-name): Idem. Set 'no-exif-data-found' and 'data' in same setq call. Use file-attribute-modification-time. --- lisp/image-dired.el | 19 +++++++++---------- lisp/image.el | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 67b023d..34e4eae 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -1912,8 +1912,8 @@ image-dired-rotate-original (message "No image at point") (let ((file (image-dired-original-file-name)) command) - (if (not (string-match "\\.[jJ][pP[eE]?[gG]$" file)) - (error "Only JPEG images can be rotated!")) + (unless (eq 'jpeg (image-type file)) + (error "Only JPEG images can be rotated!")) (setq command (format-spec image-dired-cmd-rotate-original-options (list @@ -1952,15 +1952,14 @@ image-dired-get-exif-file-name YYYY_MM_DD_HH_MM_DD_ORIG_FILE_NAME.jpg. Used from `image-dired-copy-with-exif-file-name'." (let (data no-exif-data-found) - (if (not (string-match "\\.[Jj][Pp][Ee]?[Gg]$" (expand-file-name file))) - (progn - (setq no-exif-data-found t) - (setq data - (format-time-string - "%Y:%m:%d %H:%M:%S" - (nth 5 (file-attributes (expand-file-name file)))))) + (if (not (eq 'jpeg (image-type (expand-file-name file)))) + (setq no-exif-data-found t + data (format-time-string + "%Y:%m:%d %H:%M:%S" + (file-attribute-modification-time + (file-attributes (expand-file-name file))))) (setq data (image-dired-get-exif-data (expand-file-name file) - "DateTimeOriginal"))) + "DateTimeOriginal"))) (while (string-match "[ :]" data) (setq data (replace-match "_" nil nil data))) (format "%s%s%s" data diff --git a/lisp/image.el b/lisp/image.el index 272cee5..d1cdc44 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -343,7 +343,7 @@ image-type-from-file-name "Determine the type of image file FILE from its name. Value is a symbol specifying the image type, or nil if type cannot be determined." - (let (type first) + (let (type first (case-fold-search t)) (catch 'found (dolist (elem image-type-file-name-regexps first) (when (string-match-p (car elem) file) -- 2.9.3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.20.9) of 2016-08-27 Repository revision: 7fcce24e75b8281621a0b8816dc58cbdc05fdc91