[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r100440: * dired.el (dired-mode-map):
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r100440: * dired.el (dired-mode-map): Rebind "\C-t\C-t" from |
Date: |
Tue, 25 May 2010 20:43:58 +0300 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 100440
author: Thierry Volpiatto <address@hidden>
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Tue 2010-05-25 20:43:58 +0300
message:
* 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)
modified:
lisp/ChangeLog
lisp/dired.el
lisp/image-dired.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2010-05-25 16:03:53 +0000
+++ b/lisp/ChangeLog 2010-05-25 17:43:58 +0000
@@ -1,3 +1,17 @@
+2010-05-25 Thierry Volpiatto <address@hidden>
+
+ * 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)
+
2010-05-25 Juri Linkov <address@hidden>
* image-mode.el (image-mode): Add image-after-revert-hook to
=== modified file 'lisp/dired.el'
--- a/lisp/dired.el 2010-05-20 21:33:58 +0000
+++ b/lisp/dired.el 2010-05-25 17:43:58 +0000
@@ -1409,7 +1409,7 @@
(define-key map "\C-t." 'image-dired-display-thumb)
(define-key map "\C-tc" 'image-dired-dired-comment-files)
(define-key map "\C-tf" 'image-dired-mark-tagged-files)
- (define-key map "\C-t\C-t" 'image-dired-dired-insert-marked-thumbs)
+ (define-key map "\C-t\C-t" 'image-dired-dired-toggle-marked-thumbs)
(define-key map "\C-te" 'image-dired-dired-edit-comment-and-tags)
;; encryption and decryption (epa-dired)
(define-key map ":d" 'epa-dired-do-decrypt)
=== modified file 'lisp/image-dired.el'
--- a/lisp/image-dired.el 2010-05-25 02:11:08 +0000
+++ b/lisp/image-dired.el 2010-05-25 17:43:58 +0000
@@ -157,6 +157,7 @@
(require 'widget)
(eval-when-compile
+ (require 'cl)
(require 'wid-edit))
(defgroup image-dired nil
@@ -632,26 +633,32 @@
(call-process shell-file-name nil nil nil shell-command-switch command)))
;;;###autoload
-(defun image-dired-dired-insert-marked-thumbs ()
- "Insert thumbnails before file names of marked files in the dired buffer."
- (interactive)
+(defun image-dired-dired-toggle-marked-thumbs (&optional arg)
+ "Toggle thumbnails in front of file names in the dired buffer.
+If no marked file could be found, insert or hide thumbnails on the
+current line. ARG, if non-nil, specifies the files to use instead
+of the marked files. If ARG is an integer, use the next ARG (or
+previous -ARG, if ARG<0) files."
+ (interactive "P")
(dired-map-over-marks
- (let* ((image-pos (dired-move-to-filename))
- (image-file (dired-get-filename))
- (thumb-file (image-dired-get-thumbnail-image image-file))
+ (let* ((image-pos (dired-move-to-filename))
+ (image-file (dired-get-filename 'no-dir t))
+ thumb-file
overlay)
- ;; If image is not already added, then add it.
- (unless (delq nil (mapcar (lambda (o) (overlay-get o 'put-image))
- ;; Can't use (overlays-at (point)), BUG?
- (overlays-in (point) (1+ (point)))))
- (put-image thumb-file image-pos)
- (setq
- overlay
- (car (delq nil (mapcar (lambda (o) (and (overlay-get o 'put-image) o))
- (overlays-in (point) (1+ (point)))))))
- (overlay-put overlay 'image-file image-file)
- (overlay-put overlay 'thumb-file thumb-file)))
- nil)
+ (when (and image-file (string-match-p (image-file-name-regexp)
image-file))
+ (setq thumb-file (image-dired-get-thumbnail-image image-file))
+ ;; If image is not already added, then add it.
+ (let ((cur-ov (overlays-in (point) (1+ (point)))))
+ (if cur-ov
+ (delete-overlay (car cur-ov))
+ (put-image thumb-file image-pos)
+ (setq overlay (loop for o in (overlays-in (point) (1+ (point)))
+ when (overlay-get o 'put-image) collect o into ov
+ finally return (car ov)))
+ (overlay-put overlay 'image-file image-file)
+ (overlay-put overlay 'thumb-file thumb-file)))))
+ arg ; Show or hide image on ARG next files.
+ 'show-progress) ; Update dired display after each image is updated.
(add-hook 'dired-after-readin-hook 'image-dired-dired-after-readin-hook nil
t))
(defun image-dired-dired-after-readin-hook ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r100440: * dired.el (dired-mode-map): Rebind "\C-t\C-t" from,
Juri Linkov <=