🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #714

bug in pop-to-buffer

#714
From: Piet van Oostrum
Date: Thu, 20 Aug 1992 12:41
32 lines
1737 bytes
I noticed that in emacs 18.58 pop-to-buffer does not properly set the point
if that has been changed in the mean-time. Whereas switch-to-buffer does
this correctly. E.g:

(defun ttt (new-buffer)
  (interactive "bbuffer:")
  (set-buffer new-buffer)
  (goto-char 1)
  (pop-to-buffer new-buffer)
)

The point in new-buffer will not be at 1. It will if you replace
pop-to-buffer with switch-to-buffer. In 18.55 this was working correctly

I noticed that switch-to-buffer calls set-window-buffer whereas
pop-to-buffer calls select-window

select-window calls SET_PT (marker_position (w->pointm)) which (I think)
sets the point to the value it did have on the previous edit operation,
regardless of any changes made. In 18.55 this was only done if the old and
the new window had the same buffer.

I can temporarily go around this with the following;

(defun my-pop-to-buffer (buffer &optional other)
  (set-window-point (display-buffer buffer other) (point))
  (pop-to-buffer buffer other))
-- 
Piet* van Oostrum, Dept of Computer Science, Utrecht University,
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
Telephone: +31 30 531806   Uucp:   uunet!mcsun!ruuinf!piet
Telefax:   +31 30 513791   Internet:  piet@cs.ruu.nl   (*`Pete')
Technical Details
Message-ID: <1992Aug20.124117.16812@cs.ruu.nl>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.ruu.NL!piet

Show Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.ruu.NL!piet
From: piet@cs.ruu.NL (Piet van Oostrum)
Subject: bug in pop-to-buffer
Message-ID: <1992Aug20.124117.16812@cs.ruu.nl>
Sender: gnulists@ai.mit.edu
Reply-To: piet@cs.ruu.nl (Piet van Oostrum)
Organization: Dept of Computer Science, Utrecht University, The Netherlands
Distribution: gnu
Date: Thu, 20 Aug 1992 12:41:17 GMT
Approved: bug-gnu-emacs@prep.ai.mit.edu
Lines: 33