comparison lisp/tumme.el @ 68673:5a7d4aa73d2d

(tumme-get-thumbnail-image): Add missing arg to `error'. Fix typo in message. (tumme-gallery-generate): Fix typo in `error' message. (tumme-display-window-height-correction, tumme-display-window-width-correction, tumme-line-up-dynamic, tumme-line-up-interactive): Dox fixes. (tumme-cmd-rotate-original-options, tumme-display-properties-format, tumme-restore-window-configuration, tumme-format-properties-string, tumme-create-thumbs, tumme-display-previous-thumbnail-original): Fix typos in docstrings.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 07 Feb 2006 10:16:12 +0000
parents 80719021c770
children 3a94c391ebe4
comparison
equal deleted inserted replaced
68672:c5fd7884c28b 68673:5a7d4aa73d2d
683 Available options are %p which is replaced by 683 Available options are %p which is replaced by
684 `tumme-cmd-rotate-original-program', %d which is replaced by the 684 `tumme-cmd-rotate-original-program', %d which is replaced by the
685 number of (positive) degrees to rotate the image, normally 90 or 685 number of (positive) degrees to rotate the image, normally 90 or
686 270 \(for 90 degrees right and left), %o which is replaced by the 686 270 \(for 90 degrees right and left), %o which is replaced by the
687 original image file name and %t which is replaced by 687 original image file name and %t which is replaced by
688 `tumme-temp-image-file'" 688 `tumme-temp-image-file'."
689 :type 'string 689 :type 'string
690 :group 'tumme) 690 :group 'tumme)
691 691
692 (defcustom tumme-temp-rotate-image-file 692 (defcustom tumme-temp-rotate-image-file
693 "~/.tumme/.tumme_rotate_temp" 693 "~/.tumme/.tumme_rotate_temp"
776 "*Number of thumbnails to display per row in thumb buffer." 776 "*Number of thumbnails to display per row in thumb buffer."
777 :type 'integer 777 :type 'integer
778 :group 'tumme) 778 :group 'tumme)
779 779
780 (defcustom tumme-display-window-width-correction 1 780 (defcustom tumme-display-window-width-correction 1
781 "*Number to be used to correct image display window height. 781 "*Number to be used to correct image display window width.
782 Change if the default (1) does not work (i.e. if the image does not 782 Change if the default (1) does not work (i.e. if the image does not
783 completely fit)." 783 completely fit)."
784 :type 'integer 784 :type 'integer
785 :group 'tumme) 785 :group 'tumme)
786 786
787 (defcustom tumme-display-window-height-correction 0 787 (defcustom tumme-display-window-height-correction 0
788 "*Number to be used to correct image display window height. 788 "*Number to be used to correct image display window height.
789 Use if the default (0) does not work (i.e. if the image does not 789 Change if the default (0) does not work (i.e. if the image does not
790 completely fit)." 790 completely fit)."
791 :type 'integer 791 :type 'integer
792 :group 'tumme) 792 :group 'tumme)
793 793
794 (defcustom tumme-track-movement nil 794 (defcustom tumme-track-movement nil
817 dired and you might want to turn it off." 817 dired and you might want to turn it off."
818 :type 'boolean 818 :type 'boolean
819 :group 'tumme) 819 :group 'tumme)
820 820
821 (defcustom tumme-display-properties-format "%b: %f (%t): %c" 821 (defcustom tumme-display-properties-format "%b: %f (%t): %c"
822 "* Display format for thumbnail properties. 822 "*Display format for thumbnail properties.
823 %b is replaced with associated dired buffer name, %f with file name 823 %b is replaced with associated dired buffer name, %f with file name
824 \(without path) of original image file, %t with the list of tags and %c 824 \(without path) of original image file, %t with the list of tags and %c
825 with the comment." 825 with the comment."
826 :type 'string 826 :type 'string
827 :group 'tumme) 827 :group 'tumme)
855 (insert-image i))) 855 (insert-image i)))
856 856
857 (defun tumme-get-thumbnail-image (file) 857 (defun tumme-get-thumbnail-image (file)
858 "Return the image descriptor for a thumbnail of image file FILE." 858 "Return the image descriptor for a thumbnail of image file FILE."
859 (unless (string-match (image-file-name-regexp) file) 859 (unless (string-match (image-file-name-regexp) file)
860 (error "%s is not a valid image file.")) 860 (error "%s is not a valid image file" file))
861 (let ((thumb-file (tumme-thumb-name file))) 861 (let ((thumb-file (tumme-thumb-name file)))
862 (unless (and (file-exists-p thumb-file) 862 (unless (and (file-exists-p thumb-file)
863 (<= (float-time (nth 5 (file-attributes file))) 863 (<= (float-time (nth 5 (file-attributes file)))
864 (float-time (nth 5 (file-attributes thumb-file))))) 864 (float-time (nth 5 (file-attributes thumb-file)))))
865 (tumme-create-thumb file thumb-file)) 865 (tumme-create-thumb file thumb-file))
1045 (other-window -2))))) 1045 (other-window -2)))))
1046 1046
1047 (defun tumme-restore-window-configuration () 1047 (defun tumme-restore-window-configuration ()
1048 "Restore window configuration. 1048 "Restore window configuration.
1049 Restore any changes to the window configuration made by calling 1049 Restore any changes to the window configuration made by calling
1050 `tumme-dired-with-window-configuration'" 1050 `tumme-dired-with-window-configuration'."
1051 (interactive) 1051 (interactive)
1052 (if tumme-saved-window-configuration 1052 (if tumme-saved-window-configuration
1053 (set-window-configuration tumme-saved-window-configuration) 1053 (set-window-configuration tumme-saved-window-configuration)
1054 (message "No saved window configuration"))) 1054 (message "No saved window configuration")))
1055 1055
1391 (tumme-display-thumb-properties)) 1391 (tumme-display-thumb-properties))
1392 1392
1393 (defun tumme-format-properties-string (buf file props comment) 1393 (defun tumme-format-properties-string (buf file props comment)
1394 "Format display properties. 1394 "Format display properties.
1395 BUF is the associated dired buffer, FILE is the original image file 1395 BUF is the associated dired buffer, FILE is the original image file
1396 name, PROPS is a list of tags and COMMENT is the images files's 1396 name, PROPS is a list of tags and COMMENT is the image files's
1397 comment." 1397 comment."
1398 (format-spec 1398 (format-spec
1399 tumme-display-properties-format 1399 tumme-display-properties-format
1400 (list 1400 (list
1401 (cons ?b buf) 1401 (cons ?b buf)
1821 '("Display thumb for next file" . tumme-next-line-and-display))) 1821 '("Display thumb for next file" . tumme-next-line-and-display)))
1822 1822
1823 (defun tumme-create-thumbs (&optional arg) 1823 (defun tumme-create-thumbs (&optional arg)
1824 "Create thumbnail images for all marked files in dired. 1824 "Create thumbnail images for all marked files in dired.
1825 With prefix argument ARG, create thumbnails even if they already exist 1825 With prefix argument ARG, create thumbnails even if they already exist
1826 \(i.e. use this to refresh your thumbnails)." 1826 \(i.e. use this to refresh your thumbnails)."
1827 (interactive "P") 1827 (interactive "P")
1828 (let (curr-file thumb-name files count) 1828 (let (curr-file thumb-name files count)
1829 (setq files (dired-get-marked-files)) 1829 (setq files (dired-get-marked-files))
1830 (mapcar 1830 (mapcar
1831 (lambda (curr-file) 1831 (lambda (curr-file)
1926 (setq count 0)))))) 1926 (setq count 0))))))
1927 (goto-char (point-min)))) 1927 (goto-char (point-min))))
1928 1928
1929 (defun tumme-line-up-dynamic () 1929 (defun tumme-line-up-dynamic ()
1930 "Line up thumbnails images dynamically. 1930 "Line up thumbnails images dynamically.
1931 Calculate how many thumbnails that fits." 1931 Calculate how many thumbnails fit."
1932 (interactive) 1932 (interactive)
1933 (let* ((char-width (frame-char-width)) 1933 (let* ((char-width (frame-char-width))
1934 (width (tumme-window-width-pixels (tumme-thumbnail-window))) 1934 (width (tumme-window-width-pixels (tumme-thumbnail-window)))
1935 (tumme-thumbs-per-row 1935 (tumme-thumbs-per-row
1936 (/ width 1936 (/ width
1939 tumme-thumb-size char-width)))) 1939 tumme-thumb-size char-width))))
1940 (tumme-line-up))) 1940 (tumme-line-up)))
1941 1941
1942 (defun tumme-line-up-interactive () 1942 (defun tumme-line-up-interactive ()
1943 "Line up thumbnails interactively. 1943 "Line up thumbnails interactively.
1944 Ask user how many thumbnails that should be displayed per row." 1944 Ask user how many thumbnails should be displayed per row."
1945 (interactive) 1945 (interactive)
1946 (let ((tumme-thumbs-per-row 1946 (let ((tumme-thumbs-per-row
1947 (string-to-number (read-string "How many thumbs per row: ")))) 1947 (string-to-number (read-string "How many thumbs per row: "))))
1948 (if (not (> tumme-thumbs-per-row 0)) 1948 (if (not (> tumme-thumbs-per-row 0))
1949 (message "Number must be greater than 0") 1949 (message "Number must be greater than 0")
2277 (interactive) 2277 (interactive)
2278 (tumme-forward-char) 2278 (tumme-forward-char)
2279 (tumme-display-thumbnail-original-image)) 2279 (tumme-display-thumbnail-original-image))
2280 2280
2281 (defun tumme-display-previous-thumbnail-original () 2281 (defun tumme-display-previous-thumbnail-original ()
2282 "Move to previous thumbnail and display image." 2282 "Move to previous thumbnail and display image."
2283 2283
2284 (interactive) 2284 (interactive)
2285 (tumme-backward-char) 2285 (tumme-backward-char)
2286 (tumme-display-thumbnail-original-image)) 2286 (tumme-display-thumbnail-original-image))
2287 2287
2596 count curr tag index-buf tag-buf 2596 count curr tag index-buf tag-buf
2597 comment file-tags tag-link tag-link-list) 2597 comment file-tags tag-link tag-link-list)
2598 ;; Make sure gallery root exist 2598 ;; Make sure gallery root exist
2599 (if (file-exists-p tumme-gallery-dir) 2599 (if (file-exists-p tumme-gallery-dir)
2600 (if (not (file-directory-p tumme-gallery-dir)) 2600 (if (not (file-directory-p tumme-gallery-dir))
2601 (error "Tumme-gallery-dir is not a directory")) 2601 (error "tumme-gallery-dir is not a directory"))
2602 (make-directory tumme-gallery-dir)) 2602 (make-directory tumme-gallery-dir))
2603 ;; Open index file 2603 ;; Open index file
2604 (setq index-buf (find-file 2604 (setq index-buf (find-file
2605 (format "%s/index.html" tumme-gallery-dir))) 2605 (format "%s/index.html" tumme-gallery-dir)))
2606 (erase-buffer) 2606 (erase-buffer)