diff options
| author | Tino Calancha | 2016-09-04 11:09:31 +0900 |
|---|---|---|
| committer | Tino Calancha | 2016-09-04 11:09:31 +0900 |
| commit | 2db3307e8a966a8f652a210d8f8eb83daddd7d9f (patch) | |
| tree | 053f5bbe8b3be9c893b3267e519fd9cc91fe0191 | |
| parent | 7c16c89c5772a1777e4d73ebc5ea2a3ff8344c22 (diff) | |
| download | emacs-2db3307e8a966a8f652a210d8f8eb83daddd7d9f.tar.gz emacs-2db3307e8a966a8f652a210d8f8eb83daddd7d9f.zip | |
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.
| -rw-r--r-- | lisp/image-dired.el | 19 | ||||
| -rw-r--r-- | lisp/image.el | 2 |
2 files changed, 10 insertions, 11 deletions
diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 67b023dfd70..34e4eaefbc1 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el | |||
| @@ -1912,8 +1912,8 @@ overwritten. This confirmation can be turned off using | |||
| 1912 | (message "No image at point") | 1912 | (message "No image at point") |
| 1913 | (let ((file (image-dired-original-file-name)) | 1913 | (let ((file (image-dired-original-file-name)) |
| 1914 | command) | 1914 | command) |
| 1915 | (if (not (string-match "\\.[jJ][pP[eE]?[gG]$" file)) | 1915 | (unless (eq 'jpeg (image-type file)) |
| 1916 | (error "Only JPEG images can be rotated!")) | 1916 | (error "Only JPEG images can be rotated!")) |
| 1917 | (setq command (format-spec | 1917 | (setq command (format-spec |
| 1918 | image-dired-cmd-rotate-original-options | 1918 | image-dired-cmd-rotate-original-options |
| 1919 | (list | 1919 | (list |
| @@ -1952,15 +1952,14 @@ for traceability. The format of the returned file name is | |||
| 1952 | YYYY_MM_DD_HH_MM_DD_ORIG_FILE_NAME.jpg. Used from | 1952 | YYYY_MM_DD_HH_MM_DD_ORIG_FILE_NAME.jpg. Used from |
| 1953 | `image-dired-copy-with-exif-file-name'." | 1953 | `image-dired-copy-with-exif-file-name'." |
| 1954 | (let (data no-exif-data-found) | 1954 | (let (data no-exif-data-found) |
| 1955 | (if (not (string-match "\\.[Jj][Pp][Ee]?[Gg]$" (expand-file-name file))) | 1955 | (if (not (eq 'jpeg (image-type (expand-file-name file)))) |
| 1956 | (progn | 1956 | (setq no-exif-data-found t |
| 1957 | (setq no-exif-data-found t) | 1957 | data (format-time-string |
| 1958 | (setq data | 1958 | "%Y:%m:%d %H:%M:%S" |
| 1959 | (format-time-string | 1959 | (file-attribute-modification-time |
| 1960 | "%Y:%m:%d %H:%M:%S" | 1960 | (file-attributes (expand-file-name file))))) |
| 1961 | (nth 5 (file-attributes (expand-file-name file)))))) | ||
| 1962 | (setq data (image-dired-get-exif-data (expand-file-name file) | 1961 | (setq data (image-dired-get-exif-data (expand-file-name file) |
| 1963 | "DateTimeOriginal"))) | 1962 | "DateTimeOriginal"))) |
| 1964 | (while (string-match "[ :]" data) | 1963 | (while (string-match "[ :]" data) |
| 1965 | (setq data (replace-match "_" nil nil data))) | 1964 | (setq data (replace-match "_" nil nil data))) |
| 1966 | (format "%s%s%s" data | 1965 | (format "%s%s%s" data |
diff --git a/lisp/image.el b/lisp/image.el index 791a902a1b9..e1f52de8be5 100644 --- a/lisp/image.el +++ b/lisp/image.el | |||
| @@ -343,7 +343,7 @@ be determined." | |||
| 343 | "Determine the type of image file FILE from its name. | 343 | "Determine the type of image file FILE from its name. |
| 344 | Value is a symbol specifying the image type, or nil if type cannot | 344 | Value is a symbol specifying the image type, or nil if type cannot |
| 345 | be determined." | 345 | be determined." |
| 346 | (let (type first) | 346 | (let (type first (case-fold-search t)) |
| 347 | (catch 'found | 347 | (catch 'found |
| 348 | (dolist (elem image-type-file-name-regexps first) | 348 | (dolist (elem image-type-file-name-regexps first) |
| 349 | (when (string-match-p (car elem) file) | 349 | (when (string-match-p (car elem) file) |