unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Subject: set-window-start
Date: Wed, 14 Jul 2004 21:02:41 -0500 (CDT)	[thread overview]
Message-ID: <200407150202.i6F22fR28552@raven.dms.auburn.edu> (raw)

There has been an undocumented change in the behavior of
`set-window-start' since Emacs 20.7.

In Emacs 20.7, (set-window-start WINDOW POS) makes POS the window
start, as documented.  In current CVS and in 21.3, it makes the window
start either at the _beginning_ of the line POS is on, _or_ at the
beginning of the _next_ line, according to rules that are not clear.

Is that change intentional (and just needs to be properly documented),
or a bug?

As an illustration, look at the example taken from (elisp)Window Start:

     For example, if point is 1 and you set the start of the window
     to 2, then point would be "above" the top of the window.  The
     display routines will automatically move point if it is still 1
     when redisplay occurs.  Here is an example:

          ;; Here is what `foo' looks like before executing
          ;;   the `set-window-start' expression.

          ---------- Buffer: foo ----------
          -!-This is the contents of buffer foo.
          2
          3
          4
          5
          6
          ---------- Buffer: foo ----------

          (set-window-start
           (selected-window)
           (1+ (window-start)))
          => 2

          ;; Here is what `foo' looks like after executing
          ;;   the `set-window-start' expression.
          ---------- Buffer: foo ----------
          his is the contents of buffer foo.
          2
          3
          -!-4
          5
          6
          ---------- Buffer: foo ----------

This example works as described in Emacs 20.7.  In current CVS (and in
21.3), `set-window-start' still returns 2, but the window still starts at 1
(and point does not move).

The behavior is even weirder in the next example:

This is the contents of buffer foo.
12345
2
3
4
5
6

With point anywhere on the line 12345, _except_ on the "5":

(set-window-start (selected-window) (point))

makes the window start at the beginning of that line, but on the "5",
it makes it start at the beginning of the _next_ line.

             reply	other threads:[~2004-07-15  2:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-15  2:02 Luc Teirlinck [this message]
2004-07-15  7:07 ` set-window-start Lars Hansen
2004-07-16  6:54 ` set-window-start Richard Stallman
2004-07-16 17:26   ` set-window-start Kevin Rodgers
2004-07-16 20:03     ` set-window-start Luc Teirlinck
2004-07-18  7:18     ` set-window-start Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200407150202.i6F22fR28552@raven.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).