[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12170: save-excursion fails boundary case with recenter
From: |
martin rudalics |
Subject: |
bug#12170: save-excursion fails boundary case with recenter |
Date: |
Fri, 10 Aug 2012 11:34:11 +0200 |
> (defun f (n) (save-excursion (forward-line (- n)) (recenter
> 0)))
>
>
>
> Let H be the window height in lines, and suppose that point is positioned at
> the beginning of line L > H.
>
>
>
> Despite 'save-excursion', (f K) moves point if K = H. It leaves point
> unchanged for any other value of K, 0 <= K < L.
I'm not sure whether I clearly understand your scenario. Suppose with
emacs -Q I evaluate
(progn
(defun f (n)
(save-excursion (forward-line (- n)) (recenter 0)))
(let ((buffer (switch-to-buffer "foo"))
(height (window-height (get-buffer-window "foo"))))
(insert-char 10 (* height 2))
(let ((pt (point)))
(f height)
(message "old %s new %s" pt (point)))))
Then the values printed by the message are equal. Please elaborate.
Thanks, martin