Mercurial > emacs
comparison lisp/tumme.el @ 68757:3c76b1d6eff0
Tried to make docstring less `colloquial'...
author | Mathias Dahl <mathias.dahl@gmail.com> |
---|---|
date | Thu, 09 Feb 2006 23:08:19 +0000 |
parents | 9c1ca2e3695c |
children | 86813076a765 |
comparison
equal
deleted
inserted
replaced
68756:64a4e3263fdd | 68757:3c76b1d6eff0 |
---|---|
845 :type 'string | 845 :type 'string |
846 :group 'tumme) | 846 :group 'tumme) |
847 | 847 |
848 (defcustom tumme-show-all-from-dir-max-files 50 | 848 (defcustom tumme-show-all-from-dir-max-files 50 |
849 "*Maximum number of files to show using`tumme-show-all-from-dir'. | 849 "*Maximum number of files to show using`tumme-show-all-from-dir'. |
850 before warning the user." | 850 before warning the user." |
851 :type 'integer | 851 :type 'integer |
852 :group 'tumme) | 852 :group 'tumme) |
853 | 853 |
854 (defun tumme-insert-image (file type relief margin) | 854 (defun tumme-insert-image (file type relief margin) |
855 "Insert image FILE of image TYPE, using RELIEF and MARGIN, at point." | 855 "Insert image FILE of image TYPE, using RELIEF and MARGIN, at point." |
1023 - Opens dired in folder DIR | 1023 - Opens dired in folder DIR |
1024 - Splits windows in most useful (?) way | 1024 - Splits windows in most useful (?) way |
1025 - Set `truncate-lines' to t | 1025 - Set `truncate-lines' to t |
1026 | 1026 |
1027 After the command has finished, you would typically mark some | 1027 After the command has finished, you would typically mark some |
1028 image files in dired and call `tumme-display-thumbs' (by default | 1028 image files in dired and type |
1029 bound to C-t d). | 1029 \\[tumme-display-thumbs] (`tumme-display-thumbs'). |
1030 | 1030 |
1031 If called with prefix argument ARG, skip splitting of windows. | 1031 If called with prefix argument ARG, skip splitting of windows. |
1032 | 1032 |
1033 The current window configuration is saved and can be restored by | 1033 The current window configuration is saved and can be restored by |
1034 calling `tumme-restore-window-configuration'." | 1034 calling `tumme-restore-window-configuration'." |
1117 (let ((files (dired-get-marked-files))) | 1117 (let ((files (dired-get-marked-files))) |
1118 (if (or (<= (length files) tumme-show-all-from-dir-max-files) | 1118 (if (or (<= (length files) tumme-show-all-from-dir-max-files) |
1119 (and (> (length files) tumme-show-all-from-dir-max-files) | 1119 (and (> (length files) tumme-show-all-from-dir-max-files) |
1120 (y-or-n-p | 1120 (y-or-n-p |
1121 (format | 1121 (format |
1122 "Directory contains more than %d image files. Proceed? " | 1122 "Directory contains more than %d image files. Proceed? " |
1123 tumme-show-all-from-dir-max-files)))) | 1123 tumme-show-all-from-dir-max-files)))) |
1124 (progn | 1124 (progn |
1125 (tumme-display-thumbs) | 1125 (tumme-display-thumbs) |
1126 (pop-to-buffer tumme-thumbnail-buffer)) | 1126 (pop-to-buffer tumme-thumbnail-buffer)) |
1127 (message "Cancelled.")))) | 1127 (message "Cancelled.")))) |
1830 '("Display thumb for next file" . tumme-next-line-and-display))) | 1830 '("Display thumb for next file" . tumme-next-line-and-display))) |
1831 | 1831 |
1832 (defun tumme-create-thumbs (&optional arg) | 1832 (defun tumme-create-thumbs (&optional arg) |
1833 "Create thumbnail images for all marked files in dired. | 1833 "Create thumbnail images for all marked files in dired. |
1834 With prefix argument ARG, create thumbnails even if they already exist | 1834 With prefix argument ARG, create thumbnails even if they already exist |
1835 \(i.e. use this to refresh your thumbnails)." | 1835 \(i.e. use this to refresh your thumbnails)." |
1836 (interactive "P") | 1836 (interactive "P") |
1837 (let (curr-file thumb-name files count) | 1837 (let (curr-file thumb-name files count) |
1838 (setq files (dired-get-marked-files)) | 1838 (setq files (dired-get-marked-files)) |
1839 (mapcar | 1839 (mapcar |
1840 (lambda (curr-file) | 1840 (lambda (curr-file) |
2246 (setq tag-value (buffer-substring (point-min) (point-max))))) | 2246 (setq tag-value (buffer-substring (point-min) (point-max))))) |
2247 tag-value)) | 2247 tag-value)) |
2248 | 2248 |
2249 (defun tumme-copy-with-exif-file-name () | 2249 (defun tumme-copy-with-exif-file-name () |
2250 "Copy file with unique name to main image directory. | 2250 "Copy file with unique name to main image directory. |
2251 Copy current or all marked files in dired to a new file in your main | 2251 Copy current or all marked files in dired to a new file in your |
2252 image directory, using a file name generated by | 2252 main image directory, using a file name generated by |
2253 `tumme-get-exif-file-name'. This might or might not be useful for | 2253 `tumme-get-exif-file-name'. A typical usage for this if when |
2254 other people, but I use it each time I fetch images from my digital | 2254 copying images from a digital camera into the image directory. |
2255 camera, for copying the images into my main image directory. | 2255 |
2256 | 2256 Typically, you would open up the folder with the incoming |
2257 Typically I open up the folder where I store my incoming digital | 2257 digital images, mark the files to be copied, and execute this |
2258 images, with file names like dscn0319.jpg, dscn0320.jpg etc., mark the | |
2259 files I want to copy into my main image directory, and execute this | |
2260 function. The result is a couple of new files in | 2258 function. The result is a couple of new files in |
2261 `tumme-main-image-directory' called 2005_05_08_12_52_00_dscn0319.jpg, | 2259 `tumme-main-image-directory' called |
2262 2005_05_08_14_27_45_dscn0320.jpg etc. | 2260 2005_05_08_12_52_00_dscn0319.jpg, |
2263 | 2261 2005_05_08_14_27_45_dscn0320.jpg etc." |
2264 When the images are safely in my main image directory I start to | |
2265 browse and tag them using rest of the functionality in `tumme'." | |
2266 (interactive) | 2262 (interactive) |
2267 (let (new-name | 2263 (let (new-name |
2268 (files (dired-get-marked-files))) | 2264 (files (dired-get-marked-files))) |
2269 (mapcar | 2265 (mapcar |
2270 (lambda (curr-file) | 2266 (lambda (curr-file) |
2603 count curr tag index-buf tag-buf | 2599 count curr tag index-buf tag-buf |
2604 comment file-tags tag-link tag-link-list) | 2600 comment file-tags tag-link tag-link-list) |
2605 ;; Make sure gallery root exist | 2601 ;; Make sure gallery root exist |
2606 (if (file-exists-p tumme-gallery-dir) | 2602 (if (file-exists-p tumme-gallery-dir) |
2607 (if (not (file-directory-p tumme-gallery-dir)) | 2603 (if (not (file-directory-p tumme-gallery-dir)) |
2608 (error "tumme-gallery-dir is not a directory")) | 2604 (error "Variable tumme-gallery-dir is not a directory")) |
2609 (make-directory tumme-gallery-dir)) | 2605 (make-directory tumme-gallery-dir)) |
2610 ;; Open index file | 2606 ;; Open index file |
2611 (setq index-buf (find-file | 2607 (setq index-buf (find-file |
2612 (format "%s/index.html" tumme-gallery-dir))) | 2608 (format "%s/index.html" tumme-gallery-dir))) |
2613 (erase-buffer) | 2609 (erase-buffer) |