Mercurial > emacs
changeset 55206:c2c29cafaa74
(time-less-p): Remove.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Tue, 27 Apr 2004 22:43:35 +0000 |
parents | bc07155aabd8 |
children | a3244da8e396 |
files | lisp/thumbs.el |
diffstat | 1 files changed, 25 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/thumbs.el Tue Apr 27 22:42:58 2004 +0000 +++ b/lisp/thumbs.el Tue Apr 27 22:43:35 2004 +0000 @@ -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 @@ :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 @@ "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 @@ 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 @@ 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 @@ 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 @@ "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 @@ (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 @@ (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 @@ (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 @@ (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 @@ (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 @@ (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)