[gnu.emacs.bug] recenter fails badly after a set-buffer

wolfgang@BBN.COM (08/25/89)

In GNU Emacs 18.55.1 of Wed Aug 23 1989 on Sun3 (berkeley-unix)

(recenter 0) after a  (set-buffer foo) leaves the point of the 
original buffer in an totally incorrect position.

setup: 
	sitting in buffer-a (point == 3456 [of 318376])
	<run elisp>
	set-buffer to buffer-b (point == 1234 [of 1376])
	(recenter 0)
	<finish elisp and return to top-level>
	sitting in buffer-a (point == 1756, or 1394) 

To demo for oneself, run part-a part-b and part-c via M-x.
Adjust the numbers if needed.

note: look at the screen before running part-c ...  sometimes the
screen will "snap" to the correct position when you type "<esc>x".

(defun part-a ()
  (interactive)
  (find-file "/etc/passwd") 
  (goto-char 1234)    
  (find-file "/etc/hosts")
  (goto-char 3456))

(defun part-b ()
  (interactive)
  (set-buffer "passwd")
  (recenter 0))

(defun part-c ()
  (interactive)
  (if (= (point) 3456)
      (message "No bug")
    (message "Bug spotted... point moved to %s" (point))))  

-wolfgang
---
Wolfgang Rupprecht	ARPA: wolfgang@bbn.com
TEL: (703) 848-4800	UUCP: mit-eddie!bbn.com!wolfgang