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 18:21:25 +0900 (JST) Message-ID: References: <83d1kud3m1.fsf@gnu.org> <83a8fyd1x0.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 1472289745 11504 195.159.176.226 (27 Aug 2016 09:22:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 27 Aug 2016 09:22:25 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: 24317@debbugs.gnu.org, Tino Calancha To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 27 11:22:20 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 1bdZoh-0002UC-Ut for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 Aug 2016 11:22:20 +0200 Original-Received: from localhost ([::1]:35235 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdZof-0001jw-7V for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 Aug 2016 05:22:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdZoW-0001jp-P9 for bug-gnu-emacs@gnu.org; Sat, 27 Aug 2016 05:22:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bdZoQ-0007OF-Oa for bug-gnu-emacs@gnu.org; Sat, 27 Aug 2016 05:22:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdZoQ-0007OB-Ku for bug-gnu-emacs@gnu.org; Sat, 27 Aug 2016 05:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bdZoQ-0000IT-Fu for bug-gnu-emacs@gnu.org; Sat, 27 Aug 2016 05:22: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: Sat, 27 Aug 2016 09:22: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.14722896971110 (code B ref 24317); Sat, 27 Aug 2016 09:22:02 +0000 Original-Received: (at 24317) by debbugs.gnu.org; 27 Aug 2016 09:21:37 +0000 Original-Received: from localhost ([127.0.0.1]:41842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bdZo1-0000Hp-KS for submit@debbugs.gnu.org; Sat, 27 Aug 2016 05:21:37 -0400 Original-Received: from mail-pf0-f193.google.com ([209.85.192.193]:33486) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bdZo0-0000Hc-9s for 24317@debbugs.gnu.org; Sat, 27 Aug 2016 05:21:36 -0400 Original-Received: by mail-pf0-f193.google.com with SMTP id i6so6174059pfe.0 for <24317@debbugs.gnu.org>; Sat, 27 Aug 2016 02:21:36 -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=lXGoUmiytTa/i1Sz8C+28YnlQPI9N0sw2C3wvYrPGUc=; b=SgUnsiXqacdYMPKfDMr0e8eHBVKPio5++gWDxDunrphnFxYdn4asyOsaIyMEV7MeXl xQSOWlYQ58AKijy3u69CyjGOcgoi2OdtF9ARNO+bTc2ciAto8BvnTh+7rSBsx0H8yP2j EwkWZ6mesuq5Kvf1WXfBOPRCg0ZFu20gn9um3GVCi1yLjvTiU83ykPh5bRn6sPYjwBhK tuJr5nQHZDQP5pEiEXKc8RxiQcRVYx7aBQrFBknO48oalU7dPZgJlw8CHfj9jQ8C1neC I2utyjZ9Q1NmDorRYID5AbxhTbHzq9mUlhwjgxljCW76rPmix3iKG7y5P3n7+xVSBaAv kvtQ== 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=lXGoUmiytTa/i1Sz8C+28YnlQPI9N0sw2C3wvYrPGUc=; b=dNYY7D0KE1K+n/5iv6iaFEI7njRLHECL/SdX7TGUXyYxYMIF5S1XuJOSALWyGXA6iB nyTJcK7Ao91+Kmv2K/XhCVEh6Z2GEasnfTzHiXU+2mIvbJvqtp6rZ5N5wpUJfBO7x2ck T6thsRx3ZwPimv7s4QKhRhMrbsfjzyIKEiPVHm8YDJMdmJdwsQR2QOo7InWNW+9luOZa 3V+y9o3WAbMVRv+Tx7MZ8Tu+53/QafHgBZUO2d0aiTWsfkq/Z3hA9bieM3SgnyUNKoUR x+UiUMdRZDKtvtVDPBwnXJzT77tkT6qR+9OI/Y/26szYa6LndORiBuX8yxYtvflQiUzF XrlA== X-Gm-Message-State: AE9vXwPhFhkN5jcGh6wAr8tFH2LdYgkXnsucmucnMnmb0YrYHRx3ZR98MDyNi5dYvwYThw== X-Received: by 10.98.5.133 with SMTP id 127mr13658552pff.40.1472289690384; Sat, 27 Aug 2016 02:21:30 -0700 (PDT) Original-Received: from calancha-pc ([103.5.140.167]) by smtp.gmail.com with ESMTPSA id p64sm34567625pfd.11.2016.08.27.02.21.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Aug 2016 02:21:29 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: <83a8fyd1x0.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:122715 Archived-At: > In that case, why not make a function that does the string-match as > well, in which case you won't need a variable, because it will appear > in a single place, and will also have the test localized to a single > function? > > Thanks. I see. Its good idea. I have choose a defsubst because it is small function. I am not sure if it is recommended or if people prefers always defun's. Please, et me know if the doc string reads weird and need some tunning ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From 0be47e3968d898bf8f44e5c37f9035be3147a4a2 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Sat, 27 Aug 2016 18:16:25 +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..7c8d43b 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]$" (expand-file-name 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 file))) (progn (setq no-exif-data-found t) (setq data -- 2.9.3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;