From: Eli Zaretskii <eliz@gnu.org>
To: Markus Triska <triska@metalevel.at>
Cc: 35898@debbugs.gnu.org
Subject: bug#35898: 26.1; line-beginning-position sometimes does not yield line beginning position
Date: Sat, 25 May 2019 17:01:01 +0300 [thread overview]
Message-ID: <83blzq4orm.fsf@gnu.org> (raw)
In-Reply-To: <878suullaz.fsf@metalevel.at> (message from Markus Triska on Sat, 25 May 2019 15:23:48 +0200)
> 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.
next prev parent reply other threads:[~2019-05-25 14:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2020-08-26 0:57 ` Stefan Kangas
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83blzq4orm.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=35898@debbugs.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.