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: Sat, 27 Aug 2016 21:18:37 +0900 (JST) Message-ID: References: <83d1kud3m1.fsf@gnu.org> <83a8fyd1x0.fsf@gnu.org> <87oa4e1raw.fsf@zigzag.favinet> <838tvicuy3.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-2103133435-1472300320=:20460" X-Trace: blaine.gmane.org 1472300363 7331 195.159.176.226 (27 Aug 2016 12:19:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 27 Aug 2016 12:19:23 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: Thien-Thi Nguyen , 24317@debbugs.gnu.org, tino.calancha@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 27 14:19:18 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 1bdcZx-0001Tn-TY for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 Aug 2016 14:19:18 +0200 Original-Received: from localhost ([::1]:35903 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdcZv-0007rW-A9 for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 Aug 2016 08:19:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdcZm-0007rP-HJ for bug-gnu-emacs@gnu.org; Sat, 27 Aug 2016 08:19:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bdcZi-0007uT-96 for bug-gnu-emacs@gnu.org; Sat, 27 Aug 2016 08:19:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44182) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdcZi-0007uF-4p for bug-gnu-emacs@gnu.org; Sat, 27 Aug 2016 08:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bdcZh-0006Qa-Ri for bug-gnu-emacs@gnu.org; Sat, 27 Aug 2016 08:19:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 Aug 2016 12:19:01 +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.147230033024691 (code B ref 24317); Sat, 27 Aug 2016 12:19:01 +0000 Original-Received: (at 24317) by debbugs.gnu.org; 27 Aug 2016 12:18:50 +0000 Original-Received: from localhost ([127.0.0.1]:41894 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bdcZV-0006QA-W7 for submit@debbugs.gnu.org; Sat, 27 Aug 2016 08:18:50 -0400 Original-Received: from mail-pa0-f66.google.com ([209.85.220.66]:34548) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bdcZU-0006Py-FF for 24317@debbugs.gnu.org; Sat, 27 Aug 2016 08:18:48 -0400 Original-Received: by mail-pa0-f66.google.com with SMTP id hh10so6116418pac.1 for <24317@debbugs.gnu.org>; Sat, 27 Aug 2016 05:18:48 -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=GmNaghJzpwzpcNPdP92FOXP7MVCYv9N6kYHemFS9xac=; b=y9bxQTX+NsDsAP7QgjwH8aimNmP2HTJ8Gnvui5oy/X3vMn089Jt3TTwu1UxZna/6I5 MiUCFgW3O8pQeedWcBNK4DEmJklINGn/WtaX28KLLmbIVGbK1MazKqba9YBe839Z2IWf M9DgkGU5mzY//fdtD+0FwVDOr46yeLSvuPAwTCdwEs7kYT7I57ldDQxzmSoTrJyikP2q gIuwWv1YS1aPfcY+j3gDunJxE5Wlzoo3slovMVa8+3nnil+my4NjVlJXs334DnPs1CkS /iebYwQu1wiWLJCFr7DkbP3ddQVQDYQh2RBQyIHo7lUpD6sJ4e1wd7Tv9cj712vin2hj sOfA== 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=GmNaghJzpwzpcNPdP92FOXP7MVCYv9N6kYHemFS9xac=; b=cYaW/6/BxxxpCqDVC0RBoHRHP4d//cUKFKpeHjk2AXjvjV7yPoWgDVr4seGvtbx5a5 ZVENXhIwcYUil93BO+Bdivhy/8qyXIXEoeQVN557/7n4z+AynQ2ltgjpmLXHI5cpBiBE Cny9OWXbKZLd7hI9GjL6G4QrzUMoVupV5BRvZy4tsLrrreamqcn38qMZPfU8bB51Ea0K XIdZ57AmJW4fead/5u7uTX2Tk9/lI0fDN9QHG0rAcXcwaIjNmc64XYUf4y6u70Vsx0+U li5Pn457wcs7BsHj+tIlU/G080+tMN26oBLginbLfFBVAnQI2Pw0YFfqs8HDlDCnwRIF 1jnA== X-Gm-Message-State: AE9vXwPBjeXpYKpDOp3Wne9n32ehhLXib8oXos3rXq/9uO4+VQw7677FE1IyG/Xy2c1g9Q== X-Received: by 10.66.147.234 with SMTP id tn10mr15118957pab.144.1472300322493; Sat, 27 Aug 2016 05:18:42 -0700 (PDT) Original-Received: from calancha-pc ([103.5.140.155]) by smtp.gmail.com with ESMTPSA id k78sm35877754pfa.78.2016.08.27.05.18.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Aug 2016 05:18:41 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: <838tvicuy3.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:122721 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-2103133435-1472300320=:20460 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT On Sat, 27 Aug 2016, Eli Zaretskii wrote: >> From: Thien-Thi Nguyen >> Cc: Eli Zaretskii , 24317@debbugs.gnu.org >> Date: Sat, 27 Aug 2016 11:42:31 +0200 >> >> Another idea is to use function ‘image-type’, >> which can handle a filename as its SOURCE argument. > > That is better, yes. Except that > > (let ((case-fold-search)) (image-type-from-file-name "foo.JPEG")) > => nil > > So I guess that function needs a minor change to be more robust. That's right. It wuld be worth take a look on 'image-type-from-file-name'. I have corrected previous patch. I drop expand-file-name from 'image-dired-jpeg-file-p'. I also corrected the extra paren mentioned before. If people is happy with it i will apply this patch. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From 9d95e361e45df393feaf3f6c451878e794c924eb Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Sat, 27 Aug 2016 18:41:44 +0900 Subject: [PATCH] image-dired-rotate-original: Fix regexp typo * lisp/image-dired.el (image-dired-jpeg-file-p): New defsubst; Return non-nil if a file has a JPEG extension. (image-dired-rotate-original, image-dired-get-exif-file-name): Use it (Bug#24317). --- lisp/image-dired.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 67b023d..61b0751 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -1205,6 +1205,10 @@ image-dired-dired-file-marked-p (beginning-of-line) (not (looking-at "^ .*$")))) +(defsubst image-dired-jpeg-file-p (file) + "Return non-nil if FILE has a JPEG extension." + (string-match-p "\\.[Jj][Pp][Ee]?[Gg]$" file)) + (defun image-dired-modify-mark-on-thumb-original-file (command) "Modify mark in dired buffer. COMMAND is one of `mark' for marking file in dired, `unmark' for @@ -1912,7 +1916,7 @@ 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)) + (if (not (image-dired-jpeg-file-p file)) (error "Only JPEG images can be rotated!")) (setq command (format-spec image-dired-cmd-rotate-original-options @@ -1952,7 +1956,7 @@ 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))) + (if (not (image-dired-jpeg-file-p (expand-file-name file))) (progn (setq no-exif-data-found t) (setq data -- 2.9.3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; --8323329-2103133435-1472300320=:20460--