aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Volpiatto2010-05-25 20:43:58 +0300
committerJuri Linkov2010-05-25 20:43:58 +0300
commit84fb0956565b28e9868fa1deb5f26a0d4094103e (patch)
tree3e1b1a3abda62b85d55585ae0b26b17f1d81be2d
parent0fb1193d6c3923cb3b2033e75f81a769ff2860f2 (diff)
downloademacs-84fb0956565b28e9868fa1deb5f26a0d4094103e.tar.gz
emacs-84fb0956565b28e9868fa1deb5f26a0d4094103e.zip
* dired.el (dired-mode-map): Rebind "\C-t\C-t" from
`image-dired-dired-insert-marked-thumbs' to `image-dired-dired-toggle-marked-thumbs'. * image-dired.el: Require cl when compiling. (image-dired-dired-toggle-marked-thumbs): Rename from `image-dired-dired-insert-marked-thumbs'. Add ARG. Doc fix. Use interactive spec "P". Set LOCALP arg of `dired-get-filename' to 'no-dir. Skip files whose names don't match `image-file-name-regexp'. When file has a thumbnail overlay, delete it. (Bug#5270)
-rw-r--r--lisp/ChangeLog14
-rw-r--r--lisp/dired.el2
-rw-r--r--lisp/image-dired.el43
3 files changed, 40 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 691db07cc4c..2f563ebd06b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,17 @@
12010-05-25 Thierry Volpiatto <thierry.volpiatto@gmail.com>
2
3 * dired.el (dired-mode-map): Rebind "\C-t\C-t" from
4 `image-dired-dired-insert-marked-thumbs' to
5 `image-dired-dired-toggle-marked-thumbs'.
6
7 * image-dired.el: Require cl when compiling.
8 (image-dired-dired-toggle-marked-thumbs): Rename from
9 `image-dired-dired-insert-marked-thumbs'. Add ARG. Doc fix.
10 Use interactive spec "P". Set LOCALP arg of `dired-get-filename'
11 to 'no-dir. Skip files whose names don't match
12 `image-file-name-regexp'. When file has a thumbnail overlay,
13 delete it. (Bug#5270)
14
12010-05-25 Juri Linkov <juri@jurta.org> 152010-05-25 Juri Linkov <juri@jurta.org>
2 16
3 * image-mode.el (image-mode): Add image-after-revert-hook to 17 * image-mode.el (image-mode): Add image-after-revert-hook to
diff --git a/lisp/dired.el b/lisp/dired.el
index ae9915698de..531f329b26a 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1409,7 +1409,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
1409 (define-key map "\C-t." 'image-dired-display-thumb) 1409 (define-key map "\C-t." 'image-dired-display-thumb)
1410 (define-key map "\C-tc" 'image-dired-dired-comment-files) 1410 (define-key map "\C-tc" 'image-dired-dired-comment-files)
1411 (define-key map "\C-tf" 'image-dired-mark-tagged-files) 1411 (define-key map "\C-tf" 'image-dired-mark-tagged-files)
1412 (define-key map "\C-t\C-t" 'image-dired-dired-insert-marked-thumbs) 1412 (define-key map "\C-t\C-t" 'image-dired-dired-toggle-marked-thumbs)
1413 (define-key map "\C-te" 'image-dired-dired-edit-comment-and-tags) 1413 (define-key map "\C-te" 'image-dired-dired-edit-comment-and-tags)
1414 ;; encryption and decryption (epa-dired) 1414 ;; encryption and decryption (epa-dired)
1415 (define-key map ":d" 'epa-dired-do-decrypt) 1415 (define-key map ":d" 'epa-dired-do-decrypt)
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index ce0fc4edc6a..220ad69130e 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -157,6 +157,7 @@
157(require 'widget) 157(require 'widget)
158 158
159(eval-when-compile 159(eval-when-compile
160 (require 'cl)
160 (require 'wid-edit)) 161 (require 'wid-edit))
161 162
162(defgroup image-dired nil 163(defgroup image-dired nil
@@ -632,26 +633,32 @@ according to the Thumbnail Managing Standard."
632 (call-process shell-file-name nil nil nil shell-command-switch command))) 633 (call-process shell-file-name nil nil nil shell-command-switch command)))
633 634
634;;;###autoload 635;;;###autoload
635(defun image-dired-dired-insert-marked-thumbs () 636(defun image-dired-dired-toggle-marked-thumbs (&optional arg)
636 "Insert thumbnails before file names of marked files in the dired buffer." 637 "Toggle thumbnails in front of file names in the dired buffer.
637 (interactive) 638If no marked file could be found, insert or hide thumbnails on the
639current line. ARG, if non-nil, specifies the files to use instead
640of the marked files. If ARG is an integer, use the next ARG (or
641previous -ARG, if ARG<0) files."
642 (interactive "P")
638 (dired-map-over-marks 643 (dired-map-over-marks
639 (let* ((image-pos (dired-move-to-filename)) 644 (let* ((image-pos (dired-move-to-filename))
640 (image-file (dired-get-filename)) 645 (image-file (dired-get-filename 'no-dir t))
641 (thumb-file (image-dired-get-thumbnail-image image-file)) 646 thumb-file
642 overlay) 647 overlay)
643 ;; If image is not already added, then add it. 648 (when (and image-file (string-match-p (image-file-name-regexp) image-file))
644 (unless (delq nil (mapcar (lambda (o) (overlay-get o 'put-image)) 649 (setq thumb-file (image-dired-get-thumbnail-image image-file))
645 ;; Can't use (overlays-at (point)), BUG? 650 ;; If image is not already added, then add it.
646 (overlays-in (point) (1+ (point))))) 651 (let ((cur-ov (overlays-in (point) (1+ (point)))))
647 (put-image thumb-file image-pos) 652 (if cur-ov
648 (setq 653 (delete-overlay (car cur-ov))
649 overlay 654 (put-image thumb-file image-pos)
650 (car (delq nil (mapcar (lambda (o) (and (overlay-get o 'put-image) o)) 655 (setq overlay (loop for o in (overlays-in (point) (1+ (point)))
651 (overlays-in (point) (1+ (point))))))) 656 when (overlay-get o 'put-image) collect o into ov
652 (overlay-put overlay 'image-file image-file) 657 finally return (car ov)))
653 (overlay-put overlay 'thumb-file thumb-file))) 658 (overlay-put overlay 'image-file image-file)
654 nil) 659 (overlay-put overlay 'thumb-file thumb-file)))))
660 arg ; Show or hide image on ARG next files.
661 'show-progress) ; Update dired display after each image is updated.
655 (add-hook 'dired-after-readin-hook 'image-dired-dired-after-readin-hook nil t)) 662 (add-hook 'dired-after-readin-hook 'image-dired-dired-after-readin-hook nil t))
656 663
657(defun image-dired-dired-after-readin-hook () 664(defun image-dired-dired-after-readin-hook ()