all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Thien-Thi Nguyen <ttn@gnu.org>,
	24317@debbugs.gnu.org, tino.calancha@gmail.com
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)	[thread overview]
Message-ID: <alpine.DEB.2.20.1608272114590.20460@calancha-pc> (raw)
In-Reply-To: <838tvicuy3.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2827 bytes --]



On Sat, 27 Aug 2016, Eli Zaretskii wrote:

>> From: Thien-Thi Nguyen <ttn@gnu.org>
>> Cc: Eli Zaretskii <eliz@gnu.org>,  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 <tino.calancha@gmail.com>
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

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  reply	other threads:[~2016-08-27 12:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-27  8:04 bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix Tino Calancha
2016-08-27  8:21 ` Eli Zaretskii
2016-08-27  8:53   ` Tino Calancha
2016-08-27  8:57     ` Eli Zaretskii
2016-08-27  9:21       ` Tino Calancha
2016-08-27  9:27         ` Tino Calancha
2016-08-27  9:42         ` Thien-Thi Nguyen
2016-08-27 11:28           ` Eli Zaretskii
2016-08-27 12:18             ` Tino Calancha [this message]
2016-08-27 12:55               ` Eli Zaretskii
2016-08-28 12:26                 ` Tino Calancha
2016-08-28 14:31                   ` Eli Zaretskii
2016-08-28 14:49                     ` Tino Calancha
2016-09-04  2:19                     ` Tino Calancha
2016-08-28  6:22               ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1608272114590.20460@calancha-pc \
    --to=tino.calancha@gmail.com \
    --cc=24317@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=ttn@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.