diff options
| author | Nick Roberts | 2006-01-23 23:16:58 +0000 |
|---|---|---|
| committer | Nick Roberts | 2006-01-23 23:16:58 +0000 |
| commit | dd2a3d136feb912ddd2cffe415ff96e5bc7cde43 (patch) | |
| tree | 926eb4342c732ce364620571ca4560aea758e816 | |
| parent | 3d9d607ac57ba381199030009a65e734b98eb00e (diff) | |
| download | emacs-dd2a3d136feb912ddd2cffe415ff96e5bc7cde43.tar.gz emacs-dd2a3d136feb912ddd2cffe415ff96e5bc7cde43.zip | |
(thumbs-extra-images): New variable. Make it buffer-local
and permanent-local.
(thumbs-max-image-number): New variable. Make it
(thumbs-do-thumbs-insertion): Use them
(thumbs-per-line): Change default to 4.
(thumbs-marked-list): Rename from thumbs-markedL.
(thumbs-cleanup-thumbsdir, thumbs-delete-images)
(thumbs-rename-images): Use -list instead of L for internal variables.
(thumbs-call-convert): Use call-process instead of shell-command.
(thumbs-insert-thumb): Add filename as help-echo to each image.
(thumbs-show-from-dir): Rename from thumbs-show-all-from-dir.
Give dir to thumbs-show-thumbs-list.
(thumbs-show-thumbs-list): Set default-directory to that of images.
(thumbs-dired-show): Rename from thumbs-dired-show-all.
(thumbs-display-thumbs-buffer, thumbs-show-more-images): New functions.
(thumbs-mode-map): Bind "+" to thumbs-show-more-images.
(thumbs-view-image-mode-map): Bind "^" to thumbs-display-thumbs-buffer.
| -rw-r--r-- | lisp/thumbs.el | 174 |
1 files changed, 102 insertions, 72 deletions
diff --git a/lisp/thumbs.el b/lisp/thumbs.el index a33d30ae58e..fe021d66b5e 100644 --- a/lisp/thumbs.el +++ b/lisp/thumbs.el | |||
| @@ -21,23 +21,24 @@ | |||
| 21 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | 21 | ;; along with GNU Emacs; see the file COPYING. If not, write to the |
| 22 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 22 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 23 | ;; Boston, MA 02110-1301, USA. | 23 | ;; Boston, MA 02110-1301, USA. |
| 24 | ;; | ||
| 25 | ;; Thanks: Alex Schroeder <alex@gnu.org> for maintaining the package at some time | ||
| 26 | ;; The peoples at #emacs@freenode.net for numerous help | ||
| 27 | ;; RMS for emacs and the GNU project. | ||
| 28 | ;; | ||
| 29 | 24 | ||
| 30 | ;;; Commentary: | 25 | ;;; Commentary: |
| 31 | 26 | ||
| 32 | ;; This package create two new mode: thumbs-mode and | 27 | ;; This package create two new modes: thumbs-mode and thumbs-view-image-mode. |
| 33 | ;; thumbs-view-image-mode. It is used for images browsing and viewing | 28 | ;; It is used for basic browsing and viewing of images from within Emacs. |
| 34 | ;; from within Emacs. Minimal image manipulation functions are also | 29 | ;; Minimal image manipulation functions are also available via external |
| 35 | ;; available via external programs. | 30 | ;; programs. If you want to do more complex tasks like categorise and tag |
| 31 | ;; your images, use tumme.el | ||
| 36 | ;; | 32 | ;; |
| 37 | ;; The 'convert' program from 'ImageMagick' | 33 | ;; The 'convert' program from 'ImageMagick' |
| 38 | ;; [URL:http://www.imagemagick.org/] is required. | 34 | ;; [URL:http://www.imagemagick.org/] is required. |
| 39 | ;; | 35 | ;; |
| 36 | ;; Thanks: Alex Schroeder <alex@gnu.org> for maintaining the package at some | ||
| 37 | ;; time. The peoples at #emacs@freenode.net for numerous help. RMS | ||
| 38 | ;; for emacs and the GNU project. | ||
| 39 | ;; | ||
| 40 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 40 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 41 | ;; | ||
| 41 | ;; CHANGELOG | 42 | ;; CHANGELOG |
| 42 | ;; | 43 | ;; |
| 43 | ;; This is version 2.0 | 44 | ;; This is version 2.0 |
| @@ -48,8 +49,8 @@ | |||
| 48 | ;; That should be a directory containing image files. | 49 | ;; That should be a directory containing image files. |
| 49 | ;; from dired, C-t m enter in thumbs-mode with all marked files | 50 | ;; from dired, C-t m enter in thumbs-mode with all marked files |
| 50 | ;; C-t a enter in thumbs-mode with all files in current-directory | 51 | ;; C-t a enter in thumbs-mode with all files in current-directory |
| 51 | ;; In thumbs-mode, pressing <return> on a image will bring you in image view mode | 52 | ;; In thumbs-mode, pressing <return> on a image will bring you in image view |
| 52 | ;; for that image. C-h m will give you a list of available keybinding. | 53 | ;; mode for that image. C-h m will give you a list of available keybinding. |
| 53 | 54 | ||
| 54 | ;;; History: | 55 | ;;; History: |
| 55 | ;; | 56 | ;; |
| @@ -75,13 +76,18 @@ | |||
| 75 | :type 'string | 76 | :type 'string |
| 76 | :group 'thumbs) | 77 | :group 'thumbs) |
| 77 | 78 | ||
| 78 | (defcustom thumbs-per-line 5 | 79 | (defcustom thumbs-per-line 4 |
| 79 | "*Number of thumbnails per line to show in directory." | 80 | "Number of thumbnails per line to show in directory." |
| 81 | :type 'integer | ||
| 82 | :group 'thumbs) | ||
| 83 | |||
| 84 | (defcustom thumbs-max-image-number 16 | ||
| 85 | "Maximum number of images initially displayed in thumbs buffer." | ||
| 80 | :type 'integer | 86 | :type 'integer |
| 81 | :group 'thumbs) | 87 | :group 'thumbs) |
| 82 | 88 | ||
| 83 | (defcustom thumbs-thumbsdir-max-size 50000000 | 89 | (defcustom thumbs-thumbsdir-max-size 50000000 |
| 84 | "Max size for thumbnails directory. | 90 | "Maximum size for thumbnails directory. |
| 85 | When it reaches that size (in bytes), a warning is sent." | 91 | When it reaches that size (in bytes), a warning is sent." |
| 86 | :type 'integer | 92 | :type 'integer |
| 87 | :group 'thumbs) | 93 | :group 'thumbs) |
| @@ -146,6 +152,11 @@ this value can let another user see some of your images." | |||
| 146 | "Filename of current image.") | 152 | "Filename of current image.") |
| 147 | (make-variable-buffer-local 'thumbs-current-image-filename) | 153 | (make-variable-buffer-local 'thumbs-current-image-filename) |
| 148 | 154 | ||
| 155 | (defvar thumbs-extra-images 1 | ||
| 156 | "Counter for showing extra images in thumbs buffer.") | ||
| 157 | (make-variable-buffer-local 'thumbs-extra-images) | ||
| 158 | (put 'thumbs-extra-images 'permanent-local t) | ||
| 159 | |||
| 149 | (defvar thumbs-current-image-size nil | 160 | (defvar thumbs-current-image-size nil |
| 150 | "Size of current image.") | 161 | "Size of current image.") |
| 151 | 162 | ||
| @@ -160,7 +171,7 @@ this value can let another user see some of your images." | |||
| 160 | (defvar thumbs-current-dir nil | 171 | (defvar thumbs-current-dir nil |
| 161 | "Current directory.") | 172 | "Current directory.") |
| 162 | 173 | ||
| 163 | (defvar thumbs-markedL nil | 174 | (defvar thumbs-marked-list nil |
| 164 | "List of marked files.") | 175 | "List of marked files.") |
| 165 | 176 | ||
| 166 | (defalias 'thumbs-gensym | 177 | (defalias 'thumbs-gensym |
| @@ -203,21 +214,21 @@ Create the thumbnails directory if it does not exist." | |||
| 203 | If the total size of all files in `thumbs-thumbsdir' is bigger than | 214 | If the total size of all files in `thumbs-thumbsdir' is bigger than |
| 204 | `thumbs-thumbsdir-max-size', files are deleted until the max size is | 215 | `thumbs-thumbsdir-max-size', files are deleted until the max size is |
| 205 | reached." | 216 | reached." |
| 206 | (let* ((filesL | 217 | (let* ((files-list |
| 207 | (sort | 218 | (sort |
| 208 | (mapcar | 219 | (mapcar |
| 209 | (lambda (f) | 220 | (lambda (f) |
| 210 | (let ((fattribsL (file-attributes f))) | 221 | (let ((fattribs-list (file-attributes f))) |
| 211 | `(,(nth 4 fattribsL) ,(nth 7 fattribsL) ,f))) | 222 | `(,(nth 4 fattribs-list) ,(nth 7 fattribs-list) ,f))) |
| 212 | (directory-files (thumbs-thumbsdir) t (image-file-name-regexp))) | 223 | (directory-files (thumbs-thumbsdir) t (image-file-name-regexp))) |
| 213 | '(lambda (l1 l2) (time-less-p (car l1) (car l2))))) | 224 | '(lambda (l1 l2) (time-less-p (car l1) (car l2))))) |
| 214 | (dirsize (apply '+ (mapcar (lambda (x) (cadr x)) filesL)))) | 225 | (dirsize (apply '+ (mapcar (lambda (x) (cadr x)) files-list)))) |
| 215 | (while (> dirsize thumbs-thumbsdir-max-size) | 226 | (while (> dirsize thumbs-thumbsdir-max-size) |
| 216 | (progn | 227 | (progn |
| 217 | (message "Deleting file %s" (cadr (cdar filesL)))) | 228 | (message "Deleting file %s" (cadr (cdar files-list)))) |
| 218 | (delete-file (cadr (cdar filesL))) | 229 | (delete-file (cadr (cdar files-list))) |
| 219 | (setq dirsize (- dirsize (car (cdar filesL)))) | 230 | (setq dirsize (- dirsize (car (cdar files-list)))) |
| 220 | (setq filesL (cdr filesL))))) | 231 | (setq files-list (cdr files-list))))) |
| 221 | 232 | ||
| 222 | ;; Check the thumbsnail directory size and clean it if necessary. | 233 | ;; Check the thumbsnail directory size and clean it if necessary. |
| 223 | (when thumbs-thumbsdir-auto-clean | 234 | (when thumbs-thumbsdir-auto-clean |
| @@ -242,7 +253,7 @@ ACTION-PREFIX is the symbol to place before the ACTION command | |||
| 242 | filein | 253 | filein |
| 243 | (or output-format "jpeg") | 254 | (or output-format "jpeg") |
| 244 | fileout))) | 255 | fileout))) |
| 245 | (shell-command command))) | 256 | (call-process shell-file-name nil nil nil "-c" command))) |
| 246 | 257 | ||
| 247 | (defun thumbs-increment-image-size-element (n d) | 258 | (defun thumbs-increment-image-size-element (n d) |
| 248 | "Increment number N by D percent." | 259 | "Increment number N by D percent." |
| @@ -380,57 +391,62 @@ If MARKED is non-nil, the image is marked." | |||
| 380 | If MARKED is non-nil, the image is marked." | 391 | If MARKED is non-nil, the image is marked." |
| 381 | (thumbs-insert-image | 392 | (thumbs-insert-image |
| 382 | (thumbs-make-thumb img) 'jpeg thumbs-relief marked) | 393 | (thumbs-make-thumb img) 'jpeg thumbs-relief marked) |
| 383 | (put-text-property (1- (point)) (point) | 394 | (add-text-properties (1- (point)) (point) |
| 384 | 'thumb-image-file img)) | 395 | `(thumb-image-file ,img |
| 385 | 396 | help-echo ,(file-name-nondirectory img)))) | |
| 386 | (defun thumbs-do-thumbs-insertion (L) | 397 | |
| 387 | "Insert all thumbs in list L." | 398 | (defun thumbs-do-thumbs-insertion (list) |
| 388 | (let ((i 0)) | 399 | "Insert all thumbnails into thumbs buffer." |
| 389 | (dolist (img L) | 400 | (let* ((i 0) |
| 401 | (length (length list)) | ||
| 402 | (diff (- length (* thumbs-max-image-number thumbs-extra-images)))) | ||
| 403 | (nbutlast list diff) | ||
| 404 | (dolist (img list) | ||
| 390 | (thumbs-insert-thumb img | 405 | (thumbs-insert-thumb img |
| 391 | (member img thumbs-markedL)) | 406 | (member img thumbs-marked-list)) |
| 392 | (when (= 0 (mod (setq i (1+ i)) thumbs-per-line)) | 407 | (when (= 0 (mod (setq i (1+ i)) thumbs-per-line)) |
| 393 | (newline))) | 408 | (newline))) |
| 394 | (unless (bobp) (newline)))) | 409 | (unless (bobp) (newline)) |
| 410 | (if diff (message "Type + to display more images.")))) | ||
| 395 | 411 | ||
| 396 | (defun thumbs-show-thumbs-list (L &optional buffer-name same-window) | 412 | (defun thumbs-show-thumbs-list (list &optional dir same-window) |
| 397 | (unless (and (display-images-p) | 413 | (unless (and (display-images-p) |
| 398 | (image-type-available-p 'jpeg)) | 414 | (image-type-available-p 'jpeg)) |
| 399 | (error "Required image type is not supported in this Emacs session")) | 415 | (error "Required image type is not supported in this Emacs session")) |
| 400 | (funcall (if same-window 'switch-to-buffer 'pop-to-buffer) | 416 | (funcall (if same-window 'switch-to-buffer 'pop-to-buffer) |
| 401 | (or buffer-name "*THUMB-View*")) | 417 | (if dir (concat "*Thumbs: " dir) "*THUMB-View*")) |
| 402 | (let ((inhibit-read-only t)) | 418 | (let ((inhibit-read-only t)) |
| 403 | (erase-buffer) | 419 | (erase-buffer) |
| 404 | (thumbs-mode) | 420 | (thumbs-mode) |
| 405 | (thumbs-do-thumbs-insertion L) | 421 | (if dir (setq default-directory dir)) |
| 422 | (thumbs-do-thumbs-insertion list) | ||
| 406 | (goto-char (point-min)) | 423 | (goto-char (point-min)) |
| 407 | (set (make-local-variable 'thumbs-current-dir) default-directory))) | 424 | (set (make-local-variable 'thumbs-current-dir) default-directory))) |
| 408 | 425 | ||
| 409 | ;;;###autoload | 426 | ;;;###autoload |
| 410 | (defun thumbs-show-all-from-dir (dir &optional reg same-window) | 427 | (defun thumbs-show-from-dir (dir &optional reg same-window) |
| 411 | "Make a preview buffer for all images in DIR. | 428 | "Make a preview buffer for all images in DIR. |
| 412 | Optional argument REG to select file matching a regexp, | 429 | Optional argument REG to select file matching a regexp, |
| 413 | and SAME-WINDOW to show thumbs in the same window." | 430 | and SAME-WINDOW to show thumbs in the same window." |
| 414 | (interactive "DDir: ") | 431 | (interactive "DDir: ") |
| 415 | (thumbs-show-thumbs-list | 432 | (thumbs-show-thumbs-list |
| 416 | (directory-files dir t | 433 | (directory-files dir t (or reg (image-file-name-regexp))) |
| 417 | (or reg (image-file-name-regexp))) | 434 | dir same-window)) |
| 418 | (concat "*Thumbs: " dir) same-window)) | ||
| 419 | 435 | ||
| 420 | ;;;###autoload | 436 | ;;;###autoload |
| 421 | (defun thumbs-dired-show-marked () | 437 | (defun thumbs-dired-show-marked () |
| 422 | "In dired, make a thumbs buffer with all marked files." | 438 | "In dired, make a thumbs buffer with marked files." |
| 423 | (interactive) | 439 | (interactive) |
| 424 | (thumbs-show-thumbs-list (dired-get-marked-files) nil t)) | 440 | (thumbs-show-thumbs-list (dired-get-marked-files) nil t)) |
| 425 | 441 | ||
| 426 | ;;;###autoload | 442 | ;;;###autoload |
| 427 | (defun thumbs-dired-show-all () | 443 | (defun thumbs-dired-show () |
| 428 | "In dired, make a thumbs buffer with all files in current directory." | 444 | "In dired, make a thumbs buffer with all files in current directory." |
| 429 | (interactive) | 445 | (interactive) |
| 430 | (thumbs-show-all-from-dir default-directory nil t)) | 446 | (thumbs-show-from-dir default-directory nil t)) |
| 431 | 447 | ||
| 432 | ;;;###autoload | 448 | ;;;###autoload |
| 433 | (defalias 'thumbs 'thumbs-show-all-from-dir) | 449 | (defalias 'thumbs 'thumbs-show-from-dir) |
| 434 | 450 | ||
| 435 | (defun thumbs-find-image (img &optional num otherwin) | 451 | (defun thumbs-find-image (img &optional num otherwin) |
| 436 | (let ((buffer (current-buffer))) | 452 | (let ((buffer (current-buffer))) |
| @@ -520,9 +536,9 @@ Open another window." | |||
| 520 | (defun thumbs-delete-images () | 536 | (defun thumbs-delete-images () |
| 521 | "Delete the image at point (and its thumbnail) (or marked files if any)." | 537 | "Delete the image at point (and its thumbnail) (or marked files if any)." |
| 522 | (interactive) | 538 | (interactive) |
| 523 | (let ((files (or thumbs-markedL (list (thumbs-current-image))))) | 539 | (let ((files (or thumbs-marked-list (list (thumbs-current-image))))) |
| 524 | (if (yes-or-no-p (format "Really delete %d files? " (length files))) | 540 | (if (yes-or-no-p (format "Really delete %d files? " (length files))) |
| 525 | (let ((thumbs-fileL (thumbs-file-alist)) | 541 | (let ((thumbs-file-list (thumbs-file-alist)) |
| 526 | (inhibit-read-only t)) | 542 | (inhibit-read-only t)) |
| 527 | (dolist (x files) | 543 | (dolist (x files) |
| 528 | (let (failure) | 544 | (let (failure) |
| @@ -532,24 +548,24 @@ Open another window." | |||
| 532 | (delete-file (thumbs-thumbname x))) | 548 | (delete-file (thumbs-thumbname x))) |
| 533 | (file-error (setq failure t))) | 549 | (file-error (setq failure t))) |
| 534 | (unless failure | 550 | (unless failure |
| 535 | (when (rassoc x thumbs-fileL) | 551 | (when (rassoc x thumbs-file-list) |
| 536 | (goto-char (car (rassoc x thumbs-fileL))) | 552 | (goto-char (car (rassoc x thumbs-file-list))) |
| 537 | (delete-region (point) (1+ (point)))) | 553 | (delete-region (point) (1+ (point)))) |
| 538 | (setq thumbs-markedL | 554 | (setq thumbs-marked-list |
| 539 | (delq x thumbs-markedL))))))))) | 555 | (delq x thumbs-marked-list))))))))) |
| 540 | 556 | ||
| 541 | (defun thumbs-rename-images (newfile) | 557 | (defun thumbs-rename-images (newfile) |
| 542 | "Rename the image at point (and its thumbnail) (or marked files if any)." | 558 | "Rename the image at point (and its thumbnail) (or marked files if any)." |
| 543 | (interactive "FRename to file or directory: ") | 559 | (interactive "FRename to file or directory: ") |
| 544 | (let ((files (or thumbs-markedL (list (thumbs-current-image)))) | 560 | (let ((files (or thumbs-marked-list (list (thumbs-current-image)))) |
| 545 | failures) | 561 | failures) |
| 546 | (if (and (not (file-directory-p newfile)) | 562 | (if (and (not (file-directory-p newfile)) |
| 547 | thumbs-markedL) | 563 | thumbs-marked-list) |
| 548 | (if (file-exists-p newfile) | 564 | (if (file-exists-p newfile) |
| 549 | (error "Renaming marked files to file name `%s'" newfile) | 565 | (error "Renaming marked files to file name `%s'" newfile) |
| 550 | (make-directory newfile t))) | 566 | (make-directory newfile t))) |
| 551 | (if (yes-or-no-p (format "Really rename %d files? " (length files))) | 567 | (if (yes-or-no-p (format "Really rename %d files? " (length files))) |
| 552 | (let ((thumbs-fileL (thumbs-file-alist)) | 568 | (let ((thumbs-file-list (thumbs-file-alist)) |
| 553 | (inhibit-read-only t)) | 569 | (inhibit-read-only t)) |
| 554 | (dolist (file files) | 570 | (dolist (file files) |
| 555 | (let (failure) | 571 | (let (failure) |
| @@ -563,11 +579,11 @@ Open another window." | |||
| 563 | (file-error (setq failure t) | 579 | (file-error (setq failure t) |
| 564 | (push file failures))) | 580 | (push file failures))) |
| 565 | (unless failure | 581 | (unless failure |
| 566 | (when (rassoc file thumbs-fileL) | 582 | (when (rassoc file thumbs-file-list) |
| 567 | (goto-char (car (rassoc file thumbs-fileL))) | 583 | (goto-char (car (rassoc file thumbs-file-list))) |
| 568 | (delete-region (point) (1+ (point)))) | 584 | (delete-region (point) (1+ (point)))) |
| 569 | (setq thumbs-markedL | 585 | (setq thumbs-marked-list |
| 570 | (delq file thumbs-markedL))))))) | 586 | (delq file thumbs-marked-list))))))) |
| 571 | (if failures | 587 | (if failures |
| 572 | (display-warning 'file-error | 588 | (display-warning 'file-error |
| 573 | (format "Rename failures for %s into %s" | 589 | (format "Rename failures for %s into %s" |
| @@ -594,6 +610,14 @@ Open another window." | |||
| 594 | (setq thumbs-image-num num | 610 | (setq thumbs-image-num num |
| 595 | thumbs-current-image-filename img)))) | 611 | thumbs-current-image-filename img)))) |
| 596 | 612 | ||
| 613 | (defun thumbs-previous-image () | ||
| 614 | "Show the previous image." | ||
| 615 | (interactive) | ||
| 616 | (let* ((i (- thumbs-image-num 1)) | ||
| 617 | (number (length (thumbs-file-alist)))) | ||
| 618 | (if (= i 0) (setq i (1- number))) | ||
| 619 | (thumbs-show-image-num i))) | ||
| 620 | |||
| 597 | (defun thumbs-next-image () | 621 | (defun thumbs-next-image () |
| 598 | "Show the next image." | 622 | "Show the next image." |
| 599 | (interactive) | 623 | (interactive) |
| @@ -602,13 +626,10 @@ Open another window." | |||
| 602 | (if (= i number) (setq i 1)) | 626 | (if (= i number) (setq i 1)) |
| 603 | (thumbs-show-image-num i))) | 627 | (thumbs-show-image-num i))) |
| 604 | 628 | ||
| 605 | (defun thumbs-previous-image () | 629 | (defun thumbs-display-thumbs-buffer () |
| 606 | "Show the previous image." | 630 | "Display the associated thumbs buffer." |
| 607 | (interactive) | 631 | (interactive) |
| 608 | (let* ((i (- thumbs-image-num 1)) | 632 | (display-buffer thumbs-buffer)) |
| 609 | (number (length (thumbs-file-alist)))) | ||
| 610 | (if (= i 0) (setq i (1- number))) | ||
| 611 | (thumbs-show-image-num i))) | ||
| 612 | 633 | ||
| 613 | (defun thumbs-redraw-buffer () | 634 | (defun thumbs-redraw-buffer () |
| 614 | "Redraw the current thumbs buffer." | 635 | "Redraw the current thumbs buffer." |
| @@ -625,7 +646,7 @@ Open another window." | |||
| 625 | (let ((elt (thumbs-current-image))) | 646 | (let ((elt (thumbs-current-image))) |
| 626 | (unless elt | 647 | (unless elt |
| 627 | (error "No image here")) | 648 | (error "No image here")) |
| 628 | (push elt thumbs-markedL) | 649 | (push elt thumbs-marked-list) |
| 629 | (let ((inhibit-read-only t)) | 650 | (let ((inhibit-read-only t)) |
| 630 | (delete-char 1) | 651 | (delete-char 1) |
| 631 | (thumbs-insert-thumb elt t))) | 652 | (thumbs-insert-thumb elt t))) |
| @@ -637,7 +658,7 @@ Open another window." | |||
| 637 | (let ((elt (thumbs-current-image))) | 658 | (let ((elt (thumbs-current-image))) |
| 638 | (unless elt | 659 | (unless elt |
| 639 | (error "No image here")) | 660 | (error "No image here")) |
| 640 | (setq thumbs-markedL (delete elt thumbs-markedL)) | 661 | (setq thumbs-marked-list (delete elt thumbs-marked-list)) |
| 641 | (let ((inhibit-read-only t)) | 662 | (let ((inhibit-read-only t)) |
| 642 | (delete-char 1) | 663 | (delete-char 1) |
| 643 | (thumbs-insert-thumb elt nil))) | 664 | (thumbs-insert-thumb elt nil))) |
| @@ -712,17 +733,24 @@ ACTION and ARG should be a valid convert command." | |||
| 712 | (forward-char -1)) | 733 | (forward-char -1)) |
| 713 | (thumbs-show-name)) | 734 | (thumbs-show-name)) |
| 714 | 735 | ||
| 736 | (defun thumbs-backward-line () | ||
| 737 | "Move up one line." | ||
| 738 | (interactive) | ||
| 739 | (forward-line -1) | ||
| 740 | (thumbs-show-name)) | ||
| 741 | |||
| 715 | (defun thumbs-forward-line () | 742 | (defun thumbs-forward-line () |
| 716 | "Move down one line." | 743 | "Move down one line." |
| 717 | (interactive) | 744 | (interactive) |
| 718 | (forward-line 1) | 745 | (forward-line 1) |
| 719 | (thumbs-show-name)) | 746 | (thumbs-show-name)) |
| 720 | 747 | ||
| 721 | (defun thumbs-backward-line () | 748 | (defun thumbs-show-more-images (&optional arg) |
| 722 | "Move up one line." | 749 | "Show more than `thumbs-max-image-number' images, if present." |
| 723 | (interactive) | 750 | (interactive "P") |
| 724 | (forward-line -1) | 751 | (or arg (setq arg 1)) |
| 725 | (thumbs-show-name)) | 752 | (setq thumbs-extra-images (+ thumbs-extra-images arg)) |
| 753 | (thumbs-dired-show)) | ||
| 726 | 754 | ||
| 727 | (defun thumbs-show-name () | 755 | (defun thumbs-show-name () |
| 728 | "Show the name of the current file." | 756 | "Show the name of the current file." |
| @@ -757,6 +785,7 @@ ACTION and ARG should be a valid convert command." | |||
| 757 | (define-key map [left] 'thumbs-backward-char) | 785 | (define-key map [left] 'thumbs-backward-char) |
| 758 | (define-key map [up] 'thumbs-backward-line) | 786 | (define-key map [up] 'thumbs-backward-line) |
| 759 | (define-key map [down] 'thumbs-forward-line) | 787 | (define-key map [down] 'thumbs-forward-line) |
| 788 | (define-key map "+" 'thumbs-show-more-images) | ||
| 760 | (define-key map "d" 'thumbs-dired) | 789 | (define-key map "d" 'thumbs-dired) |
| 761 | (define-key map "m" 'thumbs-mark) | 790 | (define-key map "m" 'thumbs-mark) |
| 762 | (define-key map "u" 'thumbs-unmark) | 791 | (define-key map "u" 'thumbs-unmark) |
| @@ -772,12 +801,13 @@ ACTION and ARG should be a valid convert command." | |||
| 772 | fundamental-mode "thumbs" | 801 | fundamental-mode "thumbs" |
| 773 | "Preview images in a thumbnails buffer" | 802 | "Preview images in a thumbnails buffer" |
| 774 | (setq buffer-read-only t) | 803 | (setq buffer-read-only t) |
| 775 | (set (make-local-variable 'thumbs-markedL) nil)) | 804 | (set (make-local-variable 'thumbs-marked-list) nil)) |
| 776 | 805 | ||
| 777 | (defvar thumbs-view-image-mode-map | 806 | (defvar thumbs-view-image-mode-map |
| 778 | (let ((map (make-sparse-keymap))) | 807 | (let ((map (make-sparse-keymap))) |
| 779 | (define-key map [prior] 'thumbs-previous-image) | 808 | (define-key map [prior] 'thumbs-previous-image) |
| 780 | (define-key map [next] 'thumbs-next-image) | 809 | (define-key map [next] 'thumbs-next-image) |
| 810 | (define-key map "^" 'thumbs-display-thumbs-buffer) | ||
| 781 | (define-key map "-" 'thumbs-resize-image-size-down) | 811 | (define-key map "-" 'thumbs-resize-image-size-down) |
| 782 | (define-key map "+" 'thumbs-resize-image-size-up) | 812 | (define-key map "+" 'thumbs-resize-image-size-up) |
| 783 | (define-key map "<" 'thumbs-rotate-left) | 813 | (define-key map "<" 'thumbs-rotate-left) |
| @@ -803,7 +833,7 @@ ACTION and ARG should be a valid convert command." | |||
| 803 | (thumbs-call-setroot-command (dired-get-filename))) | 833 | (thumbs-call-setroot-command (dired-get-filename))) |
| 804 | 834 | ||
| 805 | ;; Modif to dired mode map | 835 | ;; Modif to dired mode map |
| 806 | (define-key dired-mode-map "\C-ta" 'thumbs-dired-show-all) | 836 | (define-key dired-mode-map "\C-ta" 'thumbs-dired-show) |
| 807 | (define-key dired-mode-map "\C-tm" 'thumbs-dired-show-marked) | 837 | (define-key dired-mode-map "\C-tm" 'thumbs-dired-show-marked) |
| 808 | (define-key dired-mode-map "\C-tw" 'thumbs-dired-setroot) | 838 | (define-key dired-mode-map "\C-tw" 'thumbs-dired-setroot) |
| 809 | 839 | ||