unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Vivek Dasmohapatra <vivek@etla.org>
Cc: 20587@debbugs.gnu.org
Subject: bug#20587: 24.1 forward-line docs inconsistent/surprising return value
Date: Sat, 16 May 2015 10:08:56 +0300	[thread overview]
Message-ID: <83d221gfsn.fsf@gnu.org> (raw)
In-Reply-To: <alpine.DEB.2.02.1505142029370.18547@platypus.pepperfish.net>

> Date: Sat, 16 May 2015 00:23:56 +0100 (BST)
> From: Vivek Dasmohapatra <vivek@etla.org>
> 
> In the elisp manual, (forward-line X) is described as returning
> the number of lines left to move if it cannot satisfy the caller's
> request to move forward X lines.
> 
> However, calling (forward-line 1) at the start of a line with
> no terminating newline (ie the incomplete final line in a buffer,
> if it is incomplete) returns 0.
> 
> Calling (forward-line 1) at the _end_ of such a line returns 1.
> 
> The docstring for forward line does say the following at the end:
> 
> “With positive N, a non-empty line at the end counts as one line
>   successfully moved (for the return value).”
> 
> I think this is surprising and inconsistent behaviour.

Why do you think it's inconsistent?  In the first case, the command
moved; in the second one it didn't.  So the return value looks OK to
me, and I see that the implementation goes to some length to catch the
first case and return zero.  (The doc string indeed is inaccurate.)

> It doesn't seem reasonable to me, especially given that the
> documentation starts with:
> 
> “Move N lines forward (backward if N is negative).
>   Precisely, if point is on line I, move to the start of line I + N
>   ("start of line" in the logical order).”

Again, the documentation could be made more accurate, but let's first
agree on the desirable behavior, okay?





  reply	other threads:[~2015-05-16  7:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15 23:23 bug#20587: 24.1 forward-line docs inconsistent/surprising return value Vivek Dasmohapatra
2015-05-16  7:08 ` Eli Zaretskii [this message]
2015-05-16 10:07   ` Vivek Dasmohapatra
2015-05-16 13:28     ` Eli Zaretskii
2015-05-16 14:20       ` Eli Zaretskii
2015-05-23  2:50         ` Vivek Dasmohapatra
2015-05-23  3:26 ` Eric Hanchrow
2015-05-23  8:05   ` Eli Zaretskii

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=83d221gfsn.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=20587@debbugs.gnu.org \
    --cc=vivek@etla.org \
    /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).