From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#35898: 26.1; line-beginning-position sometimes does not yield line beginning position Date: Sat, 25 May 2019 17:01:01 +0300 Message-ID: <83blzq4orm.fsf@gnu.org> References: <878suullaz.fsf@metalevel.at> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="125132"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 35898@debbugs.gnu.org To: Markus Triska Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 25 16:09:49 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hUXMr-000WSX-HS for geb-bug-gnu-emacs@m.gmane.org; Sat, 25 May 2019 16:09:49 +0200 Original-Received: from localhost ([127.0.0.1]:42572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUXMq-00005c-6P for geb-bug-gnu-emacs@m.gmane.org; Sat, 25 May 2019 10:09:48 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUXMU-0008Qs-OK for bug-gnu-emacs@gnu.org; Sat, 25 May 2019 10:09:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hUXFK-00060s-8k for bug-gnu-emacs@gnu.org; Sat, 25 May 2019 10:02:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35744) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hUXFK-00060l-5c for bug-gnu-emacs@gnu.org; Sat, 25 May 2019 10:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hUXFK-0005Rp-1Z for bug-gnu-emacs@gnu.org; Sat, 25 May 2019 10:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 May 2019 14:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35898 X-GNU-PR-Package: emacs Original-Received: via spool by 35898-submit@debbugs.gnu.org id=B35898.155879287120838 (code B ref 35898); Sat, 25 May 2019 14:02:01 +0000 Original-Received: (at 35898) by debbugs.gnu.org; 25 May 2019 14:01:11 +0000 Original-Received: from localhost ([127.0.0.1]:49275 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hUXEU-0005Q1-QU for submit@debbugs.gnu.org; Sat, 25 May 2019 10:01:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38725) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hUXES-0005Ph-LZ for 35898@debbugs.gnu.org; Sat, 25 May 2019 10:01:09 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:59773) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUXEN-0005NZ-1q; Sat, 25 May 2019 10:01:03 -0400 Original-Received: from [176.228.60.248] (port=4732 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hUXEM-0004l4-7Z; Sat, 25 May 2019 10:01:02 -0400 In-reply-to: <878suullaz.fsf@metalevel.at> (message from Markus Triska on Sat, 25 May 2019 15:23:48 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:159759 Archived-At: > From: Markus Triska > 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.