emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r112736: * lisp/image-mode.el (image-


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112736: * lisp/image-mode.el (image-mode-reapply-winprops): Call image-mode-winprops
Date: Sun, 26 May 2013 20:59:33 -0400
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 112736
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14435
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Sun 2013-05-26 20:59:33 -0400
message:
  * lisp/image-mode.el (image-mode-reapply-winprops): Call image-mode-winprops
  even if there's no `display' property yet.
modified:
  lisp/ChangeLog
  lisp/image-mode.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-05-25 16:05:19 +0000
+++ b/lisp/ChangeLog    2013-05-27 00:59:33 +0000
@@ -1,6 +1,11 @@
+2013-05-27  Stefan Monnier  <address@hidden>
+
+       * image-mode.el (image-mode-reapply-winprops): Call image-mode-winprops
+       even if there's no `display' property yet (bug#14435).
+
 2013-05-25  Eli Zaretskii  <address@hidden>
 
-       * subr.el (unmsys--file-name): Renamed from reveal-filename.
+       * subr.el (unmsys--file-name): Rename from reveal-filename.
 
        * Makefile.in (custom-deps, finder-data, autoloads)
        ($(MH_E_DIR)/mh-loaddefs.el, $(TRAMP_DIR)/tramp-loaddefs.el)

=== modified file 'lisp/image-mode.el'
--- a/lisp/image-mode.el        2013-05-24 17:42:23 +0000
+++ b/lisp/image-mode.el        2013-05-27 00:59:33 +0000
@@ -104,13 +104,16 @@
 (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 (and (image-get-display-property)
-            (listp image-mode-winprops-alist))
+  (when (listp image-mode-winprops-alist)
+    ;; Beware: this call to image-mode-winprops can't be optimized away,
+    ;; because it not only gets the winprops data but sets it up if needed
+    ;; (e.g. it's used by doc-view to display the image in a new window).
     (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))
-      (if vscroll (set-window-vscroll (selected-window) vscroll)))))
+      (when (image-get-display-property) ;Only do it if we display an image!
+       (if hscroll (set-window-hscroll (selected-window) hscroll))
+       (if vscroll (set-window-vscroll (selected-window) vscroll))))))
 
 (defun image-mode-setup-winprops ()
   ;; Record current scroll settings.
@@ -329,9 +332,8 @@
 
 ;;; Image Mode setup
 
-(defvar image-type nil
+(defvar-local image-type nil
   "The image type for the current Image mode buffer.")
-(make-variable-buffer-local 'image-type)
 
 (defvar-local image-multi-frame nil
   "Non-nil if image for the current Image mode buffer has multiple frames.")
@@ -401,7 +403,6 @@
          :help "Toggle image animation"]
        ["Loop Animation"
         (lambda () (interactive)
-;;;       (make-variable-buffer-local 'image-animate-loop)
           (setq image-animate-loop (not image-animate-loop))
           ;; FIXME this is a hacky way to make it affect a currently
           ;; animating image.
@@ -461,8 +462,8 @@
        (use-local-map image-mode-map)
 
        ;; Use our own bookmarking function for images.
-       (set (make-local-variable 'bookmark-make-record-function)
-            'image-bookmark-make-record)
+       (setq-local bookmark-make-record-function
+                    #'image-bookmark-make-record)
 
        ;; Keep track of [vh]scroll when switching buffers
        (image-mode-setup-winprops)
@@ -561,7 +562,7 @@
                            elt))
                        magic-fallback-mode-alist))))
        (normal-mode)
-       (set (make-local-variable 'image-mode-previous-major-mode) major-mode)))
+       (setq-local image-mode-previous-major-mode major-mode)))
     ;; Restore `image-type' after `kill-all-local-variables' in `normal-mode'.
     (setq image-type previous-image-type)
     ;; Enable image minor mode with `C-c C-c'.
@@ -641,9 +642,9 @@
     ;; is written with, e.g., C-x C-w.
     (if (coding-system-equal (coding-system-base buffer-file-coding-system)
                             'no-conversion)
-       (set (make-local-variable 'find-file-literally) t))
-    ;; Allow navigation of large images
-    (set (make-local-variable 'auto-hscroll-mode) nil)
+       (setq-local find-file-literally t))
+    ;; Allow navigation of large images.
+    (setq-local auto-hscroll-mode nil)
     (setq image-type type)
     (if (eq major-mode 'image-mode)
        (setq mode-name (format "Image[%s]" type)))


reply via email to

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