insert-before-markers, 21.4 vs. 21.5

Stephen J. Turnbull stephen at xemacs.org
Thu Jun 1 06:47:20 EDT 2006


It looks to me like this is just a side effect of some rationalization
of the restriction markers to be processed with other markers.  I'd
say this is just a bug to be fixed.

Specifically, I don't see why it's useful or intuitive to allow
insertion into an inaccessible area of the buffer in this special case
only.  In fact, you can repeat `mess-with-buffer' and it will
repeatedly insert into the inaccessible region.  And of course if you
insert (== insert-after-marker) at the end of the buffer, it doesn't
go after the end of the visible buffer.

Ben?

>>>>> "Jerry" == Jerry James <james at xemacs.org> writes:

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



-- 
School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.




More information about the XEmacs-Beta mailing list