[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .j
From: |
Tino Calancha |
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) |
User-agent: |
Alpine 2.20 (DEB 67 2015-01-07) |
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 <tino.calancha@gmail.com>
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix, Tino Calancha, 2016/08/27
- bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix, Eli Zaretskii, 2016/08/27
- bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix, Tino Calancha, 2016/08/27
- bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix, Eli Zaretskii, 2016/08/27
- bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix,
Tino Calancha <=
- bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix, Tino Calancha, 2016/08/27
- bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix, Thien-Thi Nguyen, 2016/08/27
- bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix, Eli Zaretskii, 2016/08/27
- bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix, Tino Calancha, 2016/08/27
- bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix, Eli Zaretskii, 2016/08/27
- bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix, Tino Calancha, 2016/08/28
- bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix, Eli Zaretskii, 2016/08/28
- bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix, Tino Calancha, 2016/08/28
- bug#24317: 25.1.50; image-dired-rotate-original: regexp doesn't match .jpeg suffix, Andreas Schwab, 2016/08/28