GNU bug report logs -
#20421
25.0.50; doc string of `insert-buffer-substring'
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Fri, 24 Apr 2015 23:20:02 UTC
Severity: minor
Found in version 25.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20421 in the body.
You can then email your comments to 20421 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20421
; Package
emacs
.
(Fri, 24 Apr 2015 23:20:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Drew Adams <drew.adams <at> oracle.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 24 Apr 2015 23:20:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Unlike the doc string of `insert', this doc string does not explicitly
say the following:
Point and before-insertion markers move forward to end up
after the inserted text.
Any other markers at the point of insertion remain before the text.
It should. Here is an example where a reader did not understand some
code, partly because, it seems, this doc string is not explicit about
this.
http://emacs.stackexchange.com/q/10904/105
In GNU Emacs 25.0.50.1 (i686-pc-mingw32)
of 2014-10-20 on LEG570
Bzr revision: 118168 rgm <at> gnu.org-20141020195941-icp42t8ttcnud09g
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --enable-checking=yes,glyphs CPPFLAGS=-DGLYPH_DEBUG=1'
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Sat, 25 Apr 2015 07:53:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Drew Adams <drew.adams <at> oracle.com>
:
bug acknowledged by developer.
(Sat, 25 Apr 2015 07:53:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 20421-done <at> debbugs.gnu.org (full text, mbox):
> Date: Fri, 24 Apr 2015 16:19:28 -0700 (PDT)
> From: Drew Adams <drew.adams <at> oracle.com>
>
> Unlike the doc string of `insert', this doc string does not explicitly
> say the following:
>
> Point and before-insertion markers move forward to end up
> after the inserted text.
> Any other markers at the point of insertion remain before the text.
>
> It should.
Fixed.
> Here is an example where a reader did not understand some
> code, partly because, it seems, this doc string is not explicit about
> this.
>
> http://emacs.stackexchange.com/q/10904/105
I think that reader misunderstood something else: the difference
between point and window-point.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20421
; Package
emacs
.
(Sat, 25 Apr 2015 10:51:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 20421 <at> debbugs.gnu.org (full text, mbox):
> I think that reader misunderstood something else: the difference
> between point and window-point.
IIUC the issue at hand is more contrived. Conceptually, `window-point'
prescribes the position where to display the cursor in the corresponding
window and `window-point-insertion-type' prescribes how the cursor
should move when text is inserted at that position. But we also say:
As long as the selected window displays the current buffer, the
window's point and the buffer's point always move together; they
remain equal.
So inherently Emacs does override [at least the default value which is
nil of] `window-point-insertion-type' when appending at `window-point'
in the selected window.
Now apparently that code in `append-to-buffer'
(dolist (window windows)
(when (= (window-point window) point)
(set-window-point window (point))))
tries to mimic the same behavior for all non-selected windows that show
the same buffer and whose `window-point' equals the pre-append position
of `point' in that buffer.
Our reader should be able to see why this code makes a difference with
emacs -Q as follows:
- Make a frame with two windows showing the same buffer
- Make one of these windows the selected one
- Make sure that both windows have the same value of `window-point'
(show the cursor at the same position)
- Call `append-to-buffer' to add some text to these windows' buffer.
With the code above, both windows should have the same value of
`window-point' now. Without that code, the point of the non-selected
window should have staid behind the added text.
I have no idea why `append-to-buffer' deliberately overrides the value
of `window-point-insertion-type' or why the default value of
`window-point-insertion-type' is nil. Maybe Stefan can clarify.
martin
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20421
; Package
emacs
.
(Sat, 25 Apr 2015 14:23:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 20421 <at> debbugs.gnu.org (full text, mbox):
> > I think that reader misunderstood something else: the difference
> > between point and window-point.
>
> IIUC the issue at hand is more contrived. Conceptually, `window-
> point' prescribes the position where to display the cursor in the
> corresponding window and `window-point-insertion-type' prescribes
> how the cursor should move when text is inserted at that position.
> But we also say:
>
> As long as the selected window displays the current buffer, the
> window's point and the buffer's point always move together; they
> remain equal.
>
> So inherently Emacs does override [at least the default value which
> is nil of] `window-point-insertion-type' when appending at `window-
> point' in the selected window.
>
> Now apparently that code in `append-to-buffer'
>
> (dolist (window windows)
> (when (= (window-point window) point)
> (set-window-point window (point))))
>
> tries to mimic the same behavior for all non-selected windows that
> show the same buffer and whose `window-point' equals the pre-append
> position of `point' in that buffer.
>
> Our reader should be able to see why this code makes a difference
> with emacs -Q as follows:
>
> - Make a frame with two windows showing the same buffer
> - Make one of these windows the selected one
> - Make sure that both windows have the same value of `window-point'
> (show the cursor at the same position)
> - Call `append-to-buffer' to add some text to these windows' buffer.
>
> With the code above, both windows should have the same value of
> `window-point' now. Without that code, the point of the non-
> selected window should have staid behind the added text.
>
> I have no idea why `append-to-buffer' deliberately overrides the
> value of `window-point-insertion-type' or why the default value of
> `window-point-insertion-type' is nil. Maybe Stefan can clarify.
Good info, which helps supplement the Q&A at SE (which links to
this thread).
I wasn't even aware of `window-point-insertion-type', which was
introduced in Emacs 23 apparently.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20421
; Package
emacs
.
(Sat, 25 Apr 2015 14:50:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 20421 <at> debbugs.gnu.org (full text, mbox):
> Now apparently that code in `append-to-buffer'
Is it just me, or is append-to-buffer really weird (since it inserts at
point rather than appending at the end)?
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20421
; Package
emacs
.
(Sat, 25 Apr 2015 15:00:03 GMT)
Full text and
rfc822 format available.
Message #22 received at 20421 <at> debbugs.gnu.org (full text, mbox):
> From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
> Cc: 20421 <at> debbugs.gnu.org, eliz <at> gnu.org, drew.adams <at> oracle.com
> Date: Sat, 25 Apr 2015 10:49:21 -0400
>
> append-to-buffer [...] inserts at point rather than appending at the end
Yes, and that's what it says in its doc string.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20421
; Package
emacs
.
(Sat, 25 Apr 2015 15:36:02 GMT)
Full text and
rfc822 format available.
Message #25 received at 20421 <at> debbugs.gnu.org (full text, mbox):
> > Now apparently that code in `append-to-buffer'
>
> Is it just me, or is append-to-buffer really weird (since it inserts
> at point rather than appending at the end)?
Sidetrack. Belongs in another thread, about improving `append-to-buffer'. Please consider filing an enhancement request.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 24 May 2015 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 25 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.