Mercurial > emacs
changeset 88103:d6247c939edc
(image-mode-current-vscroll, image-mode-current-hscroll): Make buffer-local.
(image-set-window-vscroll, image-set-window-hscroll): Simplify.
(image-reset-current-vhscroll): Use the latest setting when displaying
for the first time in a window. Apply to all windows in the frame.
(image-mode): Don't make image-mode-current-[vh]scroll buffer-local.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 01 Feb 2008 01:43:36 +0000 |
parents | 0fa30755c209 |
children | d4d0381a59d8 |
files | lisp/ChangeLog lisp/image-mode.el |
diffstat | 2 files changed, 30 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Fri Feb 01 01:38:32 2008 +0000 +++ b/lisp/ChangeLog Fri Feb 01 01:43:36 2008 +0000 @@ -1,5 +1,12 @@ 2008-02-01 Stefan Monnier <monnier@iro.umontreal.ca> + * image-mode.el (image-mode-current-vscroll) + (image-mode-current-hscroll): Make buffer-local. + (image-set-window-vscroll, image-set-window-hscroll): Simplify. + (image-reset-current-vhscroll): Use the latest setting when displaying + for the first time in a window. Apply to all windows in the frame. + (image-mode): Don't make image-mode-current-[vh]scroll buffer-local. + * progmodes/grep.el (grep-compute-defaults): Don't mix up defaults for different connections to the same host.
--- a/lisp/image-mode.el Fri Feb 01 01:38:32 2008 +0000 +++ b/lisp/image-mode.el Fri Feb 01 01:43:36 2008 +0000 @@ -52,30 +52,41 @@ (defvar image-mode-current-vscroll nil "An alist with elements (WINDOW . VSCROLL).") +(make-variable-buffer-local 'image-mode-current-vscroll) (defvar image-mode-current-hscroll nil "An alist with elements (WINDOW . HSCROLL).") +(make-variable-buffer-local 'image-mode-current-hscroll) (defun image-set-window-vscroll (window vscroll &optional pixels-p) (setq image-mode-current-vscroll - (append (list (cons window vscroll)) - (delete (assoc window image-mode-current-vscroll) - image-mode-current-vscroll))) + (cons (cons window vscroll) + (delq (assq window image-mode-current-vscroll) + image-mode-current-vscroll))) (set-window-vscroll window vscroll pixels-p)) (defun image-set-window-hscroll (window ncol) (setq image-mode-current-hscroll - (append (list (cons window ncol)) - (delete (assoc window image-mode-current-hscroll) - image-mode-current-hscroll))) + (cons (cons window ncol) + (delq (assq window image-mode-current-hscroll) + image-mode-current-hscroll))) (set-window-hscroll window ncol)) (defun image-reset-current-vhscroll () - (let ((win (selected-window))) - (when (assoc win image-mode-current-hscroll) - (set-window-hscroll win (cdr (assoc win image-mode-current-hscroll)))) - (when (assoc win image-mode-current-vscroll) - (set-window-vscroll win (cdr (assoc win image-mode-current-vscroll)))))) + (walk-windows + (lambda (win) + (with-current-buffer (window-buffer win) + ;; When set-window-buffer, set hscroll and vscroll to what they were + ;; last time the image was displayed in this window. If it's the first + ;; time it's displayed in this window, use the most recent setting. + (when image-mode-current-hscroll + (set-window-hscroll win (cdr (or (assoc win image-mode-current-hscroll) + (car image-mode-current-hscroll))))) + (when image-mode-current-vscroll + (set-window-vscroll win (cdr (or (assoc win image-mode-current-vscroll) + (car image-mode-current-vscroll))))))) + 'nomini + (selected-frame))) (defun image-forward-hscroll (&optional n) "Scroll image in current window to the left by N character widths. @@ -145,7 +156,7 @@ (t (image-next-line (prefix-numeric-value n))))) (defun image-scroll-down (&optional n) - "Scroll image in current window downward by N lines + "Scroll image in current window downward by N lines. Stop if the top edge of the image is reached. If ARG is omitted or nil, scroll downward by a near full screen. A near full screen is `next-screen-context-lines' less than a full screen. @@ -253,8 +264,6 @@ 'image-bookmark-make-cell) ;; Keep track of [vh]scroll when switching buffers - (make-local-variable 'image-mode-current-hscroll) - (make-local-variable 'image-mode-current-vscroll) (image-set-window-hscroll (selected-window) (window-hscroll)) (image-set-window-vscroll (selected-window) (window-vscroll)) (add-hook 'window-configuration-change-hook