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

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1606 bytes --]

>  With positive N, a non-empty line at the end counts as one line
>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  successfully moved (for the return value).
>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> If those 2 sentences don't describe the situation with a buffer that
> ends in a line without a newline, then what is missing or unclear
> here, in your opinion?

What is unclear or misleading is, imo, the following:

  - The docstring begins by defining moving forward 1 line as
    moving to the start of the next line.

  - It then states that the function will return the number of lines
    left to move (compared to what the user requested)

  - It states that failing to move the requested number of lines is not
    an error.

So far, so good.

However, it then says, as a sparse footnote:

   “With positive N, a non-empty line at the end counts as one line”

So we have a problem of description:

“a non-empty line at the end counts as one line” is being used to mean
“a partial final line counts as a whole line”. I think this is obscure,
and its meaning is only evident in hindsight, having used the function
and discovered that forward-line returns its complete-success value (0)
even when it has not moved forward a line (per its own definition).

I also happen to think the behaviour is not sensible: If I ask to move 
forward 1 (complete) line and this canot be satisfied, the function
should return 1, as there is still 1 line left to move (but I acknowledge
that this is an old function and many things use it, and this may not
be a safe change).

  reply	other threads:[~2015-05-23  2:50 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
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 [this message]
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=alpine.DEB.2.02.1505230330190.18547@platypus.pepperfish.net \
    --to=vivek@etla.org \
    --cc=20587@debbugs.gnu.org \
    --cc=eliz@gnu.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).