[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r113475: image-dired.el: use with-current-buffer
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] trunk r113475: image-dired.el: use with-current-buffer |
Date: |
Sat, 20 Jul 2013 19:29:06 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 113475
revision-id: address@hidden
parent: address@hidden
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Sat 2013-07-20 12:29:02 -0700
message:
image-dired.el: use with-current-buffer
* lisp/image-dired.el (image-dired-track-original-file):
Use with-current-buffer.
(image-dired-track-thumbnail): Use with-current-buffer.
Avoid changing point of wrong window.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/image-dired.el
imagedired.el-20091113204419-o5vbwnq5f7feedwu-4485
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-07-20 19:25:05 +0000
+++ b/lisp/ChangeLog 2013-07-20 19:29:02 +0000
@@ -5,6 +5,11 @@
(def-gdb-preempt-display-buffer): Add explicit format.
* image-dired.el (image-dired-track-original-file):
+ Use with-current-buffer.
+ (image-dired-track-thumbnail): Use with-current-buffer.
+ Avoid changing point of wrong window.
+
+ * image-dired.el (image-dired-track-original-file):
Avoid changing point of wrong window. (Bug#14909)
2013-07-20 Richard Copley <address@hidden> (tiny change)
=== modified file 'lisp/image-dired.el'
--- a/lisp/image-dired.el 2013-07-20 19:20:33 +0000
+++ b/lisp/image-dired.el 2013-07-20 19:29:02 +0000
@@ -1039,16 +1039,14 @@
See documentation for `image-dired-toggle-movement-tracking'.
Interactive use only useful if `image-dired-track-movement' is nil."
(interactive)
- (let* ((old-buf (current-buffer))
- (dired-buf (image-dired-associated-dired-buffer))
+ (let* ((dired-buf (image-dired-associated-dired-buffer))
(file-name (image-dired-original-file-name))
(window (image-dired-get-buffer-window dired-buf)))
- (when (and (buffer-live-p dired-buf) file-name)
- (set-buffer dired-buf)
- (if (not (dired-goto-file file-name))
- (message "Could not track file")
- (if window (set-window-point window (point))))
- (set-buffer old-buf))))
+ (and (buffer-live-p dired-buf) file-name
+ (with-current-buffer dired-buf
+ (if (not (dired-goto-file file-name))
+ (message "Could not track file")
+ (if window (set-window-point window (point))))))))
(defun image-dired-toggle-movement-tracking ()
"Turn on and off `image-dired-track-movement'.
@@ -1065,24 +1063,22 @@
This is almost the same as what `image-dired-track-original-file' does,
but the other way around."
(let ((file (dired-get-filename))
- (old-buf (current-buffer))
- prop-val found)
+ prop-val found window)
(when (get-buffer image-dired-thumbnail-buffer)
- (set-buffer image-dired-thumbnail-buffer)
- (goto-char (point-min))
- (while (and (not (eobp))
- (not found))
- (if (and (setq prop-val
- (get-text-property (point) 'original-file-name))
- (string= prop-val file))
- (setq found t))
- (if (not found)
- (forward-char 1)))
- (when found
- (set-window-point
- (image-dired-thumbnail-window) (point))
- (image-dired-display-thumb-properties))
- (set-buffer old-buf))))
+ (with-current-buffer image-dired-thumbnail-buffer
+ (goto-char (point-min))
+ (while (and (not (eobp))
+ (not found))
+ (if (and (setq prop-val
+ (get-text-property (point) 'original-file-name))
+ (string= prop-val file))
+ (setq found t))
+ (if (not found)
+ (forward-char 1)))
+ (when found
+ (if (setq window (image-dired-thumbnail-window))
+ (set-window-point window (point)))
+ (image-dired-display-thumb-properties))))))
(defun image-dired-dired-next-line (&optional arg)
"Call `dired-next-line', then track thumbnail.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r113475: image-dired.el: use with-current-buffer,
Glenn Morris <=