diff options
| author | Stefan Monnier | 2013-05-26 20:59:33 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-05-26 20:59:33 -0400 |
| commit | 4fd996b38978fe8a3117d58d92091f487af0507b (patch) | |
| tree | c6dcb7e04b92f417b3f72b1c5543b849841ebd2b | |
| parent | 797c9e3df26496debbfb9bf506ad5049b503e98c (diff) | |
| download | emacs-4fd996b38978fe8a3117d58d92091f487af0507b.tar.gz emacs-4fd996b38978fe8a3117d58d92091f487af0507b.zip | |
* lisp/image-mode.el (image-mode-reapply-winprops): Call image-mode-winprops
even if there's no `display' property yet.
Fixes: debbugs:14435
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/image-mode.el | 27 |
2 files changed, 20 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8130d3e585e..7d3bbde6bc6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,6 +1,11 @@ | |||
| 1 | 2013-05-27 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * image-mode.el (image-mode-reapply-winprops): Call image-mode-winprops | ||
| 4 | even if there's no `display' property yet (bug#14435). | ||
| 5 | |||
| 1 | 2013-05-25 Eli Zaretskii <eliz@gnu.org> | 6 | 2013-05-25 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * subr.el (unmsys--file-name): Renamed from reveal-filename. | 8 | * subr.el (unmsys--file-name): Rename from reveal-filename. |
| 4 | 9 | ||
| 5 | * Makefile.in (custom-deps, finder-data, autoloads) | 10 | * Makefile.in (custom-deps, finder-data, autoloads) |
| 6 | ($(MH_E_DIR)/mh-loaddefs.el, $(TRAMP_DIR)/tramp-loaddefs.el) | 11 | ($(MH_E_DIR)/mh-loaddefs.el, $(TRAMP_DIR)/tramp-loaddefs.el) |
diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 909e2fa247f..30dfd045b46 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el | |||
| @@ -104,13 +104,16 @@ otherwise it defaults to t, used for times when the buffer is not displayed." | |||
| 104 | (defun image-mode-reapply-winprops () | 104 | (defun image-mode-reapply-winprops () |
| 105 | ;; When set-window-buffer, set hscroll and vscroll to what they were | 105 | ;; When set-window-buffer, set hscroll and vscroll to what they were |
| 106 | ;; last time the image was displayed in this window. | 106 | ;; last time the image was displayed in this window. |
| 107 | (when (and (image-get-display-property) | 107 | (when (listp image-mode-winprops-alist) |
| 108 | (listp image-mode-winprops-alist)) | 108 | ;; Beware: this call to image-mode-winprops can't be optimized away, |
| 109 | ;; because it not only gets the winprops data but sets it up if needed | ||
| 110 | ;; (e.g. it's used by doc-view to display the image in a new window). | ||
| 109 | (let* ((winprops (image-mode-winprops nil t)) | 111 | (let* ((winprops (image-mode-winprops nil t)) |
| 110 | (hscroll (image-mode-window-get 'hscroll winprops)) | 112 | (hscroll (image-mode-window-get 'hscroll winprops)) |
| 111 | (vscroll (image-mode-window-get 'vscroll winprops))) | 113 | (vscroll (image-mode-window-get 'vscroll winprops))) |
| 112 | (if hscroll (set-window-hscroll (selected-window) hscroll)) | 114 | (when (image-get-display-property) ;Only do it if we display an image! |
| 113 | (if vscroll (set-window-vscroll (selected-window) vscroll))))) | 115 | (if hscroll (set-window-hscroll (selected-window) hscroll)) |
| 116 | (if vscroll (set-window-vscroll (selected-window) vscroll)))))) | ||
| 114 | 117 | ||
| 115 | (defun image-mode-setup-winprops () | 118 | (defun image-mode-setup-winprops () |
| 116 | ;; Record current scroll settings. | 119 | ;; Record current scroll settings. |
| @@ -329,9 +332,8 @@ call." | |||
| 329 | 332 | ||
| 330 | ;;; Image Mode setup | 333 | ;;; Image Mode setup |
| 331 | 334 | ||
| 332 | (defvar image-type nil | 335 | (defvar-local image-type nil |
| 333 | "The image type for the current Image mode buffer.") | 336 | "The image type for the current Image mode buffer.") |
| 334 | (make-variable-buffer-local 'image-type) | ||
| 335 | 337 | ||
| 336 | (defvar-local image-multi-frame nil | 338 | (defvar-local image-multi-frame nil |
| 337 | "Non-nil if image for the current Image mode buffer has multiple frames.") | 339 | "Non-nil if image for the current Image mode buffer has multiple frames.") |
| @@ -401,7 +403,6 @@ call." | |||
| 401 | :help "Toggle image animation"] | 403 | :help "Toggle image animation"] |
| 402 | ["Loop Animation" | 404 | ["Loop Animation" |
| 403 | (lambda () (interactive) | 405 | (lambda () (interactive) |
| 404 | ;;; (make-variable-buffer-local 'image-animate-loop) | ||
| 405 | (setq image-animate-loop (not image-animate-loop)) | 406 | (setq image-animate-loop (not image-animate-loop)) |
| 406 | ;; FIXME this is a hacky way to make it affect a currently | 407 | ;; FIXME this is a hacky way to make it affect a currently |
| 407 | ;; animating image. | 408 | ;; animating image. |
| @@ -461,8 +462,8 @@ to toggle between display as an image and display as text." | |||
| 461 | (use-local-map image-mode-map) | 462 | (use-local-map image-mode-map) |
| 462 | 463 | ||
| 463 | ;; Use our own bookmarking function for images. | 464 | ;; Use our own bookmarking function for images. |
| 464 | (set (make-local-variable 'bookmark-make-record-function) | 465 | (setq-local bookmark-make-record-function |
| 465 | 'image-bookmark-make-record) | 466 | #'image-bookmark-make-record) |
| 466 | 467 | ||
| 467 | ;; Keep track of [vh]scroll when switching buffers | 468 | ;; Keep track of [vh]scroll when switching buffers |
| 468 | (image-mode-setup-winprops) | 469 | (image-mode-setup-winprops) |
| @@ -561,7 +562,7 @@ on these modes." | |||
| 561 | elt)) | 562 | elt)) |
| 562 | magic-fallback-mode-alist)))) | 563 | magic-fallback-mode-alist)))) |
| 563 | (normal-mode) | 564 | (normal-mode) |
| 564 | (set (make-local-variable 'image-mode-previous-major-mode) major-mode))) | 565 | (setq-local image-mode-previous-major-mode major-mode))) |
| 565 | ;; Restore `image-type' after `kill-all-local-variables' in `normal-mode'. | 566 | ;; Restore `image-type' after `kill-all-local-variables' in `normal-mode'. |
| 566 | (setq image-type previous-image-type) | 567 | (setq image-type previous-image-type) |
| 567 | ;; Enable image minor mode with `C-c C-c'. | 568 | ;; Enable image minor mode with `C-c C-c'. |
| @@ -641,9 +642,9 @@ was inserted." | |||
| 641 | ;; is written with, e.g., C-x C-w. | 642 | ;; is written with, e.g., C-x C-w. |
| 642 | (if (coding-system-equal (coding-system-base buffer-file-coding-system) | 643 | (if (coding-system-equal (coding-system-base buffer-file-coding-system) |
| 643 | 'no-conversion) | 644 | 'no-conversion) |
| 644 | (set (make-local-variable 'find-file-literally) t)) | 645 | (setq-local find-file-literally t)) |
| 645 | ;; Allow navigation of large images | 646 | ;; Allow navigation of large images. |
| 646 | (set (make-local-variable 'auto-hscroll-mode) nil) | 647 | (setq-local auto-hscroll-mode nil) |
| 647 | (setq image-type type) | 648 | (setq image-type type) |
| 648 | (if (eq major-mode 'image-mode) | 649 | (if (eq major-mode 'image-mode) |
| 649 | (setq mode-name (format "Image[%s]" type))) | 650 | (setq mode-name (format "Image[%s]" type))) |