X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/9850eff524bd0747a9561f3b4c90dfc3749f4ecb..7e09ef09a479731d01b1ca46e94ddadd73ac98e3:/lisp/thumbs.el diff --git a/lisp/thumbs.el b/lisp/thumbs.el index bb62d4cf6a..d8bb8cb34f 100644 --- a/lisp/thumbs.el +++ b/lisp/thumbs.el @@ -1,9 +1,9 @@ ;;; thumbs.el --- Thumbnails previewer for images files -;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +;; Copyright (C) 2004-2015 Free Software Foundation, Inc. ;; Author: Jean-Philippe Theberge -;; Maintainer: FSF +;; Maintainer: emacs-devel@gnu.org ;; Keywords: Multimedia ;; This file is part of GNU Emacs. @@ -26,7 +26,7 @@ ;; This package create two new modes: thumbs-mode and thumbs-view-image-mode. ;; It is used for basic browsing and viewing of images from within Emacs. ;; Minimal image manipulation functions are also available via external -;; programs. If you want to do more complex tasks like categorise and tag +;; programs. If you want to do more complex tasks like categorize and tag ;; your images, use image-dired.el ;; ;; The 'convert' program from 'ImageMagick' @@ -57,6 +57,7 @@ ;;; Code: (require 'dired) +(require 'cl-lib) ; for cl-gensym ;; CUSTOMIZATIONS @@ -65,13 +66,13 @@ :version "22.1" :group 'multimedia) -(defcustom thumbs-thumbsdir (concat user-emacs-directory "thumbs") - "*Directory to store thumbnails." +(defcustom thumbs-thumbsdir (locate-user-emacs-file "thumbs") + "Directory to store thumbnails." :type 'directory :group 'thumbs) (defcustom thumbs-geometry "100x100" - "*Size of thumbnails." + "Size of thumbnails." :type 'string :group 'thumbs) @@ -92,7 +93,7 @@ When it reaches that size (in bytes), a warning is sent." :group 'thumbs) ;; Unfortunately Windows XP has a program called CONVERT.EXE in -;; C:/WINDOWS/SYSTEM32/ for partioning NTFS system. So Emacs +;; C:/WINDOWS/SYSTEM32/ for partitioning NTFS systems. So Emacs ;; can find the one in your ImageMagick directory, you need to ;; customize this value to the absolute filename. (defcustom thumbs-conversion-program @@ -100,7 +101,7 @@ When it reaches that size (in bytes), a warning is sent." "convert.exe" (or (executable-find "convert") "/usr/X11R6/bin/convert")) - "*Name of conversion program for thumbnails generation. + "Name of conversion program for thumbnails generation. It must be 'convert'." :type 'string :group 'thumbs) @@ -112,12 +113,12 @@ It must be 'convert'." :group 'thumbs) (defcustom thumbs-relief 5 - "*Size of button-like border around thumbnails." + "Size of button-like border around thumbnails." :type 'integer :group 'thumbs) (defcustom thumbs-margin 2 - "*Size of the margin around thumbnails. + "Size of the margin around thumbnails. This is where you see the cursor." :type 'integer :group 'thumbs) @@ -179,21 +180,6 @@ this value can let another user see some of your images." (make-variable-buffer-local 'thumbs-marked-list) (put 'thumbs-marked-list 'permanent-local t) -(defalias 'thumbs-gensym - (if (fboundp 'gensym) - 'gensym - ;; Copied from cl-macs.el - (defvar thumbs-gensym-counter 0) - (lambda (&optional prefix) - "Generate a new uninterned symbol. -The name is made by appending a number to PREFIX, default \"G\"." - (let ((pfix (if (stringp prefix) prefix "G")) - (num (if (integerp prefix) prefix - (prog1 thumbs-gensym-counter - (setq thumbs-gensym-counter - (1+ thumbs-gensym-counter)))))) - (make-symbol (format "%s%d" pfix num)))))) - (defsubst thumbs-temp-dir () (file-name-as-directory (expand-file-name thumbs-temp-dir))) @@ -202,7 +188,7 @@ The name is made by appending a number to PREFIX, default \"G\"." (format "%s%s-%s.jpg" (thumbs-temp-dir) thumbs-temp-prefix - (thumbs-gensym "T"))) + (cl-gensym "T"))) (defun thumbs-thumbsdir () "Return the current thumbnails directory (from `thumbs-thumbsdir'). @@ -226,7 +212,7 @@ reached." (let ((fattribs-list (file-attributes f))) `(,(nth 4 fattribs-list) ,(nth 7 fattribs-list) ,f))) (directory-files (thumbs-thumbsdir) t (image-file-name-regexp))) - '(lambda (l1 l2) (time-less-p (car l1) (car l2))))) + (lambda (l1 l2) (time-less-p (car l1) (car l2))))) (dirsize (apply '+ (mapcar (lambda (x) (cadr x)) files-list)))) (while (> dirsize thumbs-thumbsdir-max-size) (progn @@ -235,7 +221,7 @@ reached." (setq dirsize (- dirsize (car (cdar files-list)))) (setq files-list (cdr files-list))))) -;; Check the thumbsnail directory size and clean it if necessary. +;; Check the thumbnail directory size and clean it if necessary. (when thumbs-thumbsdir-auto-clean (thumbs-cleanup-thumbsdir)) @@ -816,5 +802,4 @@ ACTION and ARG should be a valid convert command." (provide 'thumbs) -;; arch-tag: f9ac1ef8-83fc-42c0-8069-1fae43fd2e5c ;;; thumbs.el ends here