diff options
Diffstat (limited to 'lisp/thumbs.el')
-rw-r--r-- | lisp/thumbs.el | 57 |
1 files changed, 25 insertions, 32 deletions
diff --git a/lisp/thumbs.el b/lisp/thumbs.el index cc692c1f975..8bba647a2ad 100644 --- a/lisp/thumbs.el +++ b/lisp/thumbs.el @@ -1,7 +1,7 @@ ;;; thumbs.el --- Thumbnails previewer for images files ;;; ;; Author: Jean-Philippe Theberge <jphiltheberge@videotron.ca> -;; +;; ;; Thanks: Alex Schroeder <alex@gnu.org> for maintaining the package at some time ;; The peoples at #emacs@freenode.net for numerous help ;; RMS for emacs and the GNU project. @@ -52,7 +52,7 @@ ;; for that image. C-h m will give you a list of available keybinding. ;;; History: -;; +;; ;;; Code: @@ -62,9 +62,9 @@ (when (not (display-images-p)) (error "Your Emacs version (%S) doesn't support in-line images, -was not compiled with image support or is run in console mode. -Upgrade to Emacs 21.1 or newer, compile it with image support -or use a window-system" +was not compiled with image support or is run in console mode. +Upgrade to Emacs 21.1 or newer, compile it with image support +or use a window-system" emacs-version)) ;; CUSTOMIZATIONS @@ -148,26 +148,26 @@ see some of your images." :group 'thumbs) ;; Initialize some variable, for later use. -(defvar thumbs-temp-file - (concat thumbs-temp-dir thumbs-temp-prefix) +(defvar thumbs-temp-file + (concat thumbs-temp-dir thumbs-temp-prefix) "Temporary filesname for images.") -(defvar thumbs-current-tmp-filename - nil +(defvar thumbs-current-tmp-filename + nil "Temporary filename of current image.") -(defvar thumbs-current-image-filename +(defvar thumbs-current-image-filename nil "Filename of current image.") -(defvar thumbs-current-image-size +(defvar thumbs-current-image-size nil "Size of current image.") -(defvar thumbs-image-num +(defvar thumbs-image-num nil "Number of current image.") -(defvar thumbs-current-dir +(defvar thumbs-current-dir nil "Current directory.") -(defvar thumbs-markedL +(defvar thumbs-markedL nil "List of marked files.") @@ -187,14 +187,7 @@ see some of your images." "Execute FORMS; if anz error occurs, return nil. Otherwise, return result of last FORM." (let ((err (thumbs-gensym))) - (list 'condition-case err (cons 'progn body) '(error nil))))) - -(when (not (fboundp 'time-less-p)) - (defun time-less-p (t1 t2) - "Say whether time T1 is less than time T2." - (or (< (car t1) (car t2)) - (and (= (car t1) (car t2)) - (< (nth 1 t1) (nth 1 t2)))))) + (list 'condition-case err (cons 'progn body) '(error nil))))) (when (not (fboundp 'caddar)) (defun caddar (x) @@ -208,7 +201,7 @@ Otherwise, return result of last FORM." The name is made by appending a number to PREFIX, default \"Thumbs\"." (let ((prefix (if (stringp arg) arg "Thumbs")) (num (if (integerp arg) arg - (prog1 + (prog1 thumbs-gensym-counter (setq thumbs-gensym-counter (1+ thumbs-gensym-counter)))))) (make-symbol (format "%s%d" prefix num)))) @@ -274,7 +267,7 @@ ACTION-PREFIX is the symbol to place before the ACTION command thumbs-image-resizing-step) (thumbs-increment-image-size-element (cdr s) thumbs-image-resizing-step))) - + (defun thumbs-decrement-image-size (s) "Decrement S (a cons of width x heigh)." (cons @@ -289,7 +282,7 @@ if INCREMENT is set, make the image bigger, else smaller. Or, alternatively, a SIZE may be specified." (interactive) ;; cleaning of old temp file - (ignore-errors + (ignore-errors (apply 'delete-file (directory-files thumbs-temp-dir t @@ -315,7 +308,7 @@ Or, alternatively, a SIZE may be specified." "Resize Image interactively to specified WIDTH and HEIGHT." (interactive "nWidth: \nnHeight: ") (thumbs-resize-image nil (cons width height))) - + (defun thumbs-resize-image-size-down () "Resize image (smaller)." (interactive) @@ -356,7 +349,7 @@ Return the resulting (new) string. -- (defun borowed to Dave Love)" (not (equal (thumbs-file-size tn) thumbs-geometry))) (thumbs-call-convert fn tn "sample" thumbs-geometry)) tn)) - + (defun thumbs-image-type (img) "Return image type from filename IMG." (cond ((string-match ".*\\.jpe?g\\'" img) 'jpeg) @@ -372,7 +365,7 @@ Return the resulting (new) string. -- (defun borowed to Dave Love)" (concat (number-to-string (round (car i))) "x" (number-to-string (round (cdr i)))))) - + ;;;###autoload (defun thumbs-find-thumb (img) "Display the thumbnail for IMG." @@ -453,7 +446,7 @@ and SAME-WINDOW to show thumbs in the same window." (defalias 'thumbs 'thumbs-show-all-from-dir) (defun thumbs-find-image (img L &optional num otherwin) - (funcall + (funcall (if otherwin 'switch-to-buffer-other-window 'switch-to-buffer) (concat "*Image: " (file-name-nondirectory img) " - " (number-to-string (or num 0)) "*")) @@ -494,7 +487,7 @@ Open another window." (shell-quote-argument (expand-file-name img)) thumbs-setroot-command nil t)) (run-hooks 'thumbs-after-setroot-hook)) - + (defun thumbs-set-image-at-point-to-root-window () "Set the image at point as the desktop wallpaper." (interactive) @@ -569,7 +562,7 @@ Open another window." (delete-region (point-min)(point-max)) (thumbs-do-thumbs-insertion (reverse (mapcar 'cdr thumbs-fileL))) (goto-char (1+ p)))) - + (defun thumbs-mark () "Mark the image at point." (interactive) @@ -578,7 +571,7 @@ Open another window." (delete-char 1) (thumbs-insert-thumb (cdr (assoc (point) thumbs-fileL)) t)) (when (eolp)(forward-char))) - + ;; Image modification routines (defun thumbs-modify-image (action &optional arg) |