From: Tino Calancha <tino.calancha@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: ttn@gnu.org, 24317@debbugs.gnu.org, schwab@linux-m68k.org,
Tino Calancha <tino.calancha@gmail.com>
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) [thread overview]
Message-ID: <alpine.DEB.2.20.1608282124270.7961@calancha-pc> (raw)
In-Reply-To: <837fb2cqx1.fsf@gnu.org>
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 <tino.calancha@gmail.com>
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
next prev parent reply other threads:[~2016-08-28 12:26 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
2016-08-27 12:55 ` Eli Zaretskii
2016-08-28 12:26 ` Tino Calancha [this message]
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
List information: https://www.gnu.org/software/emacs/
* 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.1608282124270.7961@calancha-pc \
--to=tino.calancha@gmail.com \
--cc=24317@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=schwab@linux-m68k.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).