From: Noam Postavsky <npostavs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 35899@debbugs.gnu.org, Markus Triska <triska@metalevel.at>
Subject: bug#35899: 26.1; move-beginning-of-line sometimes does not move to beginning of line
Date: Fri, 21 Jun 2019 06:05:22 -0400 [thread overview]
Message-ID: <871rznw8wt.fsf@gmail.com> (raw)
In-Reply-To: <838suu4n1y.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 25 May 2019 17:38:01 +0300")
[-- Attachment #1: Type: text/plain, Size: 957 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> However, the documentation of move-beginning-of-line includes:
>>
>> (If there’s an image in the line, this disregards newlines
>> which are part of the text that the image rests on.)
>>
>> Hence, I expect this to move to position 1. For comparison, when I press
>> C-a, it does move to position 1, as expected.
>
> "the text that the image rests on" refers to the text which is
> "covered" by the display property, not the newlines in the binary data
> that constitutes the image file's data.
If I create an image which rests on some newlines like this:
(let ((img (create-image "bug-35899-hello.png")))
(insert "abc")
(insert-image img "foo\nbar\nbaz")
(insert "def"))
Then with point after "def", move-beginning-of-line stops "inside" the
image. And I don't see anything in its code which would allow it to
skip the image. Isn't this just a doc bug?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 3034 bytes --]
From f64d539780c0aa8e1a3322afa518eb768f468e16 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Fri, 21 Jun 2019 05:52:14 -0400
Subject: [PATCH] Clarify docs about line movement (Bug#35899)
* doc/lispref/positions.texi (Text Lines, Screen Lines): Add index
entries.
* lisp/simple.el (move-beginning-of-line): Remove incorrect mention of
images, and reference beginning-of-visual-line.
* src/editfns.c (Fline_beginning_position): Reference
`vertical-motion'.
---
doc/lispref/positions.texi | 3 +++
lisp/simple.el | 8 ++++----
src/editfns.c | 3 ++-
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index 7707793467..128685800f 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -332,6 +332,8 @@ Buffer End Motion
@node Text Lines
@subsection Motion by Text Lines
@cindex lines
+@cindex logical lines, moving by
+@cindex physical lines, moving by
Text lines are portions of the buffer delimited by newline characters,
which are regarded as part of the previous line. The first text line
@@ -515,6 +517,7 @@ Text Lines
@node Screen Lines
@subsection Motion by Screen Lines
@cindex screen lines, moving by
+@cindex visual lines, moving by
The line functions in the previous section count text lines, delimited
only by newline characters. By contrast, these functions count screen
diff --git a/lisp/simple.el b/lisp/simple.el
index a0f2da7152..010a7ae563 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -6638,15 +6638,15 @@ (defun move-end-of-line (arg)
(setq done t)))))))
(defun move-beginning-of-line (arg)
- "Move point to beginning of current line as displayed.
-\(If there's an image in the line, this disregards newlines
-which are part of the text that the image rests on.)
+ "Move point to visible beginning of current logical line.
+This disregards any invisible newline characters.
With argument ARG not nil or 1, move forward ARG - 1 lines first.
If point reaches the beginning or end of buffer, it stops there.
\(But if the buffer doesn't end in a newline, it stops at the
beginning of the last line.)
-To ignore intangibility, bind `inhibit-point-motion-hooks' to t."
+To ignore intangibility, bind `inhibit-point-motion-hooks' to t.
+For motion by visual lines, see `beginning-of-visual-line'."
(interactive "^p")
(or arg (setq arg 1))
diff --git a/src/editfns.c b/src/editfns.c
index 9b76ae23ff..7e16fbd0ed 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -910,7 +910,8 @@ DEFUN ("line-beginning-position",
This function ignores text display directionality; it returns the
position of the first character in logical order, i.e. the smallest
-character position on the line.
+character position on the logical line. See `vertical-motion' for
+movement by screen lines.
This function constrains the returned position to the current field
unless that position would be on a different line than the original,
--
2.11.0
next prev parent reply other threads:[~2019-06-21 10:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-25 13:31 bug#35899: 26.1; move-beginning-of-line sometimes does not move to beginning of line Markus Triska
2019-05-25 14:38 ` Eli Zaretskii
2019-06-21 10:05 ` Noam Postavsky [this message]
2019-06-21 12:30 ` Eli Zaretskii
2019-06-22 22:54 ` Noam Postavsky
2019-06-23 15:54 ` Eli Zaretskii
2019-06-23 16:31 ` Noam Postavsky
2020-08-21 13:09 ` Lars Ingebrigtsen
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=871rznw8wt.fsf@gmail.com \
--to=npostavs@gmail.com \
--cc=35899@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=triska@metalevel.at \
/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).