insert-before-markers, 21.4 vs. 21.5

Jerry James james at xemacs.org
Thu Jun 1 01:09:43 EDT 2006


Regarding the shell buffer starting narrowed problem, it is in fact a
result of the use of insert-before-markers by the new comint.el code.
Try this:

(defun mess-with-buffer ()
  "Mess around with restrictions in a buffer."
  (interactive)
  (save-restriction
    (widen)
    (goto-char (point-min))
    (insert-before-markers "This is a test.")))

On 21.4, you will see "This is a test." at the beginning of the victim
buffer.  On 21.5, you will see no change to your buffer, unless you
happen to notice the word "Narrowed" appear on the modeline.  If you
then widen the buffer, you will see "This is a test." at the beginning.

The difference is that, on 21.4, insert-before-markers does not change
the state saved by save-restriction.  On 21.5, insert-before-markers
modifies the markers saved by save-restriction as well as all other
markers associated with the buffer.  Therefore, on restoring the state
when leaving save-restriction, the code sees that the buffer does not
start at position 1, and thus identifies it as narrowed.

If we are concerned about Emacs compatibility, we need to change the
21.5 code to match the behavior of 21.4.

If we are not concerned about Emacs compatibility, then I need an
alternative to insert-before-markers that works on both 21.4 and 21.5.

Thanks,
-- 
Jerry James, Assistant Professor        james at xemacs.org
Computer Science Department             http://www.cs.usu.edu/~jerry/
Utah State University




More information about the XEmacs-Beta mailing list