emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/image-mode.el,v


From: Chong Yidong
Subject: [Emacs-diffs] Changes to emacs/lisp/image-mode.el,v
Date: Thu, 22 May 2008 21:27:42 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      08/05/22 21:27:42

Index: image-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/image-mode.el,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- image-mode.el       6 May 2008 07:57:39 -0000       1.43
+++ image-mode.el       22 May 2008 21:27:42 -0000      1.44
@@ -56,10 +56,19 @@
   "Special hook run when image data is requested in a new window.
 It is called with one argument, the initial WINPROPS.")
 
-(defun image-mode-winprops (&optional window)
+(defun image-mode-winprops (&optional window cleanup)
   "Return winprops of WINDOW.
 A winprops object has the shape (WINDOW . ALIST)."
-  (unless window (setq window (selected-window)))
+  (cond ((null window)
+        (setq window (selected-window)))
+       ((not (windowp window))
+        (error "Not a window: %s" window)))
+  (when cleanup
+    (setq image-mode-winprops-alist
+         (delq nil (mapcar (lambda (winprop)
+                             (if (window-live-p (car-safe winprop))
+                                 winprop))
+                           image-mode-winprops-alist))))
   (let ((winprops (assq window image-mode-winprops-alist)))
     ;; For new windows, set defaults from the latest.
     (unless winprops
@@ -94,8 +103,9 @@
 (defun image-mode-reapply-winprops ()
   ;; When set-window-buffer, set hscroll and vscroll to what they were
   ;; last time the image was displayed in this window.
-  (when (listp image-mode-winprops-alist)
-    (let* ((winprops (image-mode-winprops))
+  (when (and (image-get-display-property)
+            (listp image-mode-winprops-alist))
+    (let* ((winprops (image-mode-winprops nil t))
            (hscroll (image-mode-window-get 'hscroll winprops))
            (vscroll (image-mode-window-get 'vscroll winprops)))
       (if hscroll (set-window-hscroll (selected-window) hscroll))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]