diff options
| author | Juanma Barranquero | 2005-06-10 14:59:59 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2005-06-10 14:59:59 +0000 |
| commit | 6cae5f240fedafade79e31e06b73ca1bcb82cf5e (patch) | |
| tree | b05738d8a85ca0c0bc405517d795549e31265fed | |
| parent | a8ab3e96074252549b8f9f9a53939c09b60ebee9 (diff) | |
| download | emacs-6cae5f240fedafade79e31e06b73ca1bcb82cf5e.tar.gz emacs-6cae5f240fedafade79e31e06b73ca1bcb82cf5e.zip | |
Fixes for changes of 2005-06-09.
(thumbs-thumbsdir): Force `thumbs-thumbsdir' to be interpretable as a directory.
(thumbs-thumbname): Remove directory separator from format string;
`thumbs-thumbsdir' now returns a valid directory name.
(thumbs-temp-dir): New defsubst.
(thumbs-temp-file, thumbs-resize-image, thumbs-modify-image): Use it.
| -rw-r--r-- | lisp/thumbs.el | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/thumbs.el b/lisp/thumbs.el index 0fa44a3b8ee..0eb58206916 100644 --- a/lisp/thumbs.el +++ b/lisp/thumbs.el | |||
| @@ -172,17 +172,21 @@ The name is made by appending a number to PREFIX, default \"G\"." | |||
| 172 | (1+ thumbs-gensym-counter)))))) | 172 | (1+ thumbs-gensym-counter)))))) |
| 173 | (make-symbol (format "%s%d" pfix num)))))) | 173 | (make-symbol (format "%s%d" pfix num)))))) |
| 174 | 174 | ||
| 175 | (defsubst thumbs-temp-dir () | ||
| 176 | (file-name-as-directory (expand-file-name thumbs-temp-dir))) | ||
| 177 | |||
| 175 | (defun thumbs-temp-file () | 178 | (defun thumbs-temp-file () |
| 176 | "Return a unique temporary filename for an image." | 179 | "Return a unique temporary filename for an image." |
| 177 | (format "%s%s-%s.jpg" | 180 | (format "%s%s-%s.jpg" |
| 178 | (expand-file-name thumbs-temp-dir) | 181 | (thumbs-temp-dir) |
| 179 | thumbs-temp-prefix | 182 | thumbs-temp-prefix |
| 180 | (thumbs-gensym "T"))) | 183 | (thumbs-gensym "T"))) |
| 181 | 184 | ||
| 182 | (defun thumbs-thumbsdir () | 185 | (defun thumbs-thumbsdir () |
| 183 | "Return the current thumbnails directory (from `thumbs-thumbsdir'). | 186 | "Return the current thumbnails directory (from `thumbs-thumbsdir'). |
| 184 | Create the thumbnails directory if it does not exist." | 187 | Create the thumbnails directory if it does not exist." |
| 185 | (let ((thumbs-thumbsdir (expand-file-name thumbs-thumbsdir))) | 188 | (let ((thumbs-thumbsdir (file-name-as-directory |
| 189 | (expand-file-name thumbs-thumbsdir)))) | ||
| 186 | (unless (file-directory-p thumbs-thumbsdir) | 190 | (unless (file-directory-p thumbs-thumbsdir) |
| 187 | (make-directory thumbs-thumbsdir) | 191 | (make-directory thumbs-thumbsdir) |
| 188 | (message "Creating thumbnails directory")) | 192 | (message "Creating thumbnails directory")) |
| @@ -267,7 +271,7 @@ Or, alternatively, a SIZE may be specified." | |||
| 267 | (condition-case nil | 271 | (condition-case nil |
| 268 | (apply 'delete-file | 272 | (apply 'delete-file |
| 269 | (directory-files | 273 | (directory-files |
| 270 | thumbs-temp-dir t | 274 | (thumbs-temp-dir) t |
| 271 | thumbs-temp-prefix)) | 275 | thumbs-temp-prefix)) |
| 272 | (error nil)) | 276 | (error nil)) |
| 273 | (let ((buffer-read-only nil) | 277 | (let ((buffer-read-only nil) |
| @@ -306,7 +310,7 @@ Or, alternatively, a SIZE may be specified." | |||
| 306 | "Return a thumbnail name for the image IMG." | 310 | "Return a thumbnail name for the image IMG." |
| 307 | (convert-standard-filename | 311 | (convert-standard-filename |
| 308 | (let ((filename (expand-file-name img))) | 312 | (let ((filename (expand-file-name img))) |
| 309 | (format "%s/%08x-%s.jpg" | 313 | (format "%s%08x-%s.jpg" |
| 310 | (thumbs-thumbsdir) | 314 | (thumbs-thumbsdir) |
| 311 | (sxhash filename) | 315 | (sxhash filename) |
| 312 | (subst-char-in-string | 316 | (subst-char-in-string |
| @@ -637,7 +641,7 @@ ACTION and ARG should be a valid convert command." | |||
| 637 | ;; cleaning of old temp file | 641 | ;; cleaning of old temp file |
| 638 | (mapc 'delete-file | 642 | (mapc 'delete-file |
| 639 | (directory-files | 643 | (directory-files |
| 640 | thumbs-temp-dir | 644 | (thumbs-temp-dir) |
| 641 | t | 645 | t |
| 642 | thumbs-temp-prefix)) | 646 | thumbs-temp-prefix)) |
| 643 | (let ((buffer-read-only nil) | 647 | (let ((buffer-read-only nil) |