* bug#35898: 26.1; line-beginning-position sometimes does not yield line beginning position
@ 2019-05-25 13:23 Markus Triska
2019-05-25 14:01 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: Markus Triska @ 2019-05-25 13:23 UTC (permalink / raw)
To: 35898
Please download hello.png with:
$ wget https://www.metalevel.at/ei/hello.png
and then, starting Emacs with "emacs -Q", evaluate the following form:
(progn
(goto-char (point-min))
(save-excursion (insert "\n"))
(goto-char (+ (point) (cadr (insert-image-file "hello.png"))))
(line-beginning-position))
This yields 592, whereas I expect it to yield 1.
For comparison, when I do C-a to move to the beginning of the line, it
moves to position 1, as expected.
Is there a way to make line-beginning-position yield the line beginning
position in cases like this? Would you please consider adding this feature?
Thank you and all the best,
Markus
In GNU Emacs 26.1 (build 3, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars)
of 2019-04-09 built on mt-laptop
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#35898: 26.1; line-beginning-position sometimes does not yield line beginning position
2019-05-25 13:23 bug#35898: 26.1; line-beginning-position sometimes does not yield line beginning position Markus Triska
@ 2019-05-25 14:01 ` Eli Zaretskii
2020-08-26 0:57 ` Stefan Kangas
0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2019-05-25 14:01 UTC (permalink / raw)
To: Markus Triska; +Cc: 35898
> From: Markus Triska <triska@metalevel.at>
> Date: Sat, 25 May 2019 15:23:48 +0200
>
> $ wget https://www.metalevel.at/ei/hello.png
>
> and then, starting Emacs with "emacs -Q", evaluate the following form:
>
> (progn
> (goto-char (point-min))
> (save-excursion (insert "\n"))
> (goto-char (+ (point) (cadr (insert-image-file "hello.png"))))
> (line-beginning-position))
>
> This yields 592, whereas I expect it to yield 1.
Your expectations are unjustified, because line-beginning-position is
not supposed to work on visual lines, it works on logical/physical
lines, i.e. it scans the buffer for newline characters.
For visual-line operation, you can use either beginning-of-visual-line
or vertical-motion (the former actually calls the latter internally).
> Is there a way to make line-beginning-position yield the line beginning
> position in cases like this? Would you please consider adding this feature?
We already have features to query about the visual lines, so I don't
see why we would need line-beginning-position work in terms of visual
lines. It will fail Lisp programs that want to disregard the visual
appearance of the buffer.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#35898: 26.1; line-beginning-position sometimes does not yield line beginning position
2019-05-25 14:01 ` Eli Zaretskii
@ 2020-08-26 0:57 ` Stefan Kangas
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Kangas @ 2020-08-26 0:57 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 35898, Markus Triska
tags 35898 + notabug
close 35898
thanks
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Markus Triska <triska@metalevel.at>
>> Date: Sat, 25 May 2019 15:23:48 +0200
>>
>> $ wget https://www.metalevel.at/ei/hello.png
>>
>> and then, starting Emacs with "emacs -Q", evaluate the following form:
>>
>> (progn
>> (goto-char (point-min))
>> (save-excursion (insert "\n"))
>> (goto-char (+ (point) (cadr (insert-image-file "hello.png"))))
>> (line-beginning-position))
>>
>> This yields 592, whereas I expect it to yield 1.
>
> Your expectations are unjustified, because line-beginning-position is
> not supposed to work on visual lines, it works on logical/physical
> lines, i.e. it scans the buffer for newline characters.
>
> For visual-line operation, you can use either beginning-of-visual-line
> or vertical-motion (the former actually calls the latter internally).
>
>> Is there a way to make line-beginning-position yield the line beginning
>> position in cases like this? Would you please consider adding this feature?
>
> We already have features to query about the visual lines, so I don't
> see why we would need line-beginning-position work in terms of visual
> lines. It will fail Lisp programs that want to disregard the visual
> appearance of the buffer.
As Eli has correctly explained, this is the expected behaviour. So I'm
therefore closing this bug report.
If this conclusion is incorrect, please reply to this email (use "Reply
to all" in your email client) and we can reopen the bug report.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-26 0:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-25 13:23 bug#35898: 26.1; line-beginning-position sometimes does not yield line beginning position Markus Triska
2019-05-25 14:01 ` Eli Zaretskii
2020-08-26 0:57 ` Stefan Kangas
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).