bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35898: 26.1; line-beginning-position sometimes does not yield line b


From: Stefan Kangas
Subject: bug#35898: 26.1; line-beginning-position sometimes does not yield line beginning position
Date: Tue, 25 Aug 2020 17:57:05 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]