/[emacs]/emacs/lisp/thumbs.el
ViewVC logotype

Diff of /emacs/lisp/thumbs.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by lektu, Thu Jun 9 01:39:40 2005 UTC revision 1.16 by lektu, Fri Jun 10 14:59:59 2005 UTC
# Line 172  The name is made by appending a number t Line 172  The name is made by appending a number t
172                               (1+ thumbs-gensym-counter))))))                               (1+ thumbs-gensym-counter))))))
173            (make-symbol (format "%s%d" pfix num))))))            (make-symbol (format "%s%d" pfix num))))))
174    
175    (defsubst thumbs-temp-dir ()
176      (file-name-as-directory (expand-file-name thumbs-temp-dir)))
177    
178  (defun thumbs-temp-file ()  (defun thumbs-temp-file ()
179    "Return a unique temporary filename for an image."    "Return a unique temporary filename for an image."
180    (format "%s%s-%s.jpg"    (format "%s%s-%s.jpg"
181            (expand-file-name thumbs-temp-dir)            (thumbs-temp-dir)
182            thumbs-temp-prefix            thumbs-temp-prefix
183            (thumbs-gensym "T")))            (thumbs-gensym "T")))
184    
185  (defun thumbs-thumbsdir ()  (defun thumbs-thumbsdir ()
186    "Return the current thumbnails directory (from `thumbs-thumbsdir').    "Return the current thumbnails directory (from `thumbs-thumbsdir').
187  Create the thumbnails directory if it does not exist."  Create the thumbnails directory if it does not exist."
188    (let ((thumbs-thumbsdir (expand-file-name thumbs-thumbsdir)))    (let ((thumbs-thumbsdir (file-name-as-directory
189                               (expand-file-name thumbs-thumbsdir))))
190      (unless (file-directory-p thumbs-thumbsdir)      (unless (file-directory-p thumbs-thumbsdir)
191        (make-directory thumbs-thumbsdir)        (make-directory thumbs-thumbsdir)
192        (message "Creating thumbnails directory"))        (message "Creating thumbnails directory"))
# Line 267  Or, alternatively, a SIZE may be specifi Line 271  Or, alternatively, a SIZE may be specifi
271    (condition-case nil    (condition-case nil
272      (apply 'delete-file      (apply 'delete-file
273             (directory-files             (directory-files
274              thumbs-temp-dir t              (thumbs-temp-dir) t
275              thumbs-temp-prefix))              thumbs-temp-prefix))
276      (error nil))      (error nil))
277    (let ((buffer-read-only nil)    (let ((buffer-read-only nil)
# Line 306  Or, alternatively, a SIZE may be specifi Line 310  Or, alternatively, a SIZE may be specifi
310    "Return a thumbnail name for the image IMG."    "Return a thumbnail name for the image IMG."
311    (convert-standard-filename    (convert-standard-filename
312     (let ((filename (expand-file-name img)))     (let ((filename (expand-file-name img)))
313       (format "%s/%08x-%s.jpg"       (format "%s%08x-%s.jpg"
314               (thumbs-thumbsdir)               (thumbs-thumbsdir)
315               (sxhash filename)               (sxhash filename)
316               (subst-char-in-string               (subst-char-in-string
# Line 637  ACTION and ARG should be a valid convert Line 641  ACTION and ARG should be a valid convert
641    ;; cleaning of old temp file    ;; cleaning of old temp file
642    (mapc 'delete-file    (mapc 'delete-file
643          (directory-files          (directory-files
644           thumbs-temp-dir           (thumbs-temp-dir)
645           t           t
646           thumbs-temp-prefix))           thumbs-temp-prefix))
647    (let ((buffer-read-only nil)    (let ((buffer-read-only nil)

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26