GNU bug report logs - #35898
26.1; line-beginning-position sometimes does not yield line beginning position

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Markus Triska <triska@HIDDEN>; dated Sat, 25 May 2019 13:25:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 35898 <at> debbugs.gnu.org:


Received: (at 35898) by debbugs.gnu.org; 25 May 2019 14:01:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 25 10:01:11 2019
Received: from localhost ([127.0.0.1]:49275 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hUXEU-0005Q1-QU
	for submit <at> debbugs.gnu.org; Sat, 25 May 2019 10:01:11 -0400
Received: from eggs.gnu.org ([209.51.188.92]:38725)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1hUXES-0005Ph-LZ
 for 35898 <at> debbugs.gnu.org; Sat, 25 May 2019 10:01:09 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:59773)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1hUXEN-0005NZ-1q; Sat, 25 May 2019 10:01:03 -0400
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 <eliz@HIDDEN>)
 id 1hUXEM-0004l4-7Z; Sat, 25 May 2019 10:01:02 -0400
Date: Sat, 25 May 2019 17:01:01 +0300
Message-Id: <83blzq4orm.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Markus Triska <triska@HIDDEN>
In-reply-to: <878suullaz.fsf@HIDDEN> (message from Markus Triska on Sat, 
 25 May 2019 15:23:48 +0200)
Subject: Re: bug#35898: 26.1;
 line-beginning-position sometimes does not yield line beginning
 position
References: <878suullaz.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 35898
Cc: 35898 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Markus Triska <triska@HIDDEN>
> 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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#35898; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 25 May 2019 13:24:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 25 09:24:11 2019
Received: from localhost ([127.0.0.1]:48406 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hUWeh-0004Bb-0t
	for submit <at> debbugs.gnu.org; Sat, 25 May 2019 09:24:11 -0400
Received: from eggs.gnu.org ([209.51.188.92]:34545)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <triska@HIDDEN>) id 1hUWef-0004BL-BQ
 for submit <at> debbugs.gnu.org; Sat, 25 May 2019 09:24:09 -0400
Received: from lists.gnu.org ([209.51.188.17]:36944)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <triska@HIDDEN>) id 1hUWea-0007tz-8J
 for submit <at> debbugs.gnu.org; Sat, 25 May 2019 09:24:04 -0400
Received: from eggs.gnu.org ([209.51.188.92]:48921)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <triska@HIDDEN>) id 1hUWeZ-0008WH-2m
 for bug-gnu-emacs@HIDDEN; Sat, 25 May 2019 09:24:04 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,URIBL_BLOCKED
 autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <triska@HIDDEN>) id 1hUWeX-0007sw-V8
 for bug-gnu-emacs@HIDDEN; Sat, 25 May 2019 09:24:03 -0400
Received: from metalevel.at ([78.46.218.83]:36900)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <triska@HIDDEN>) id 1hUWeX-0007pr-Ov
 for bug-gnu-emacs@HIDDEN; Sat, 25 May 2019 09:24:01 -0400
Received: from mt-Lenovo-ideapad-120S-11IAP (localhost.localdomain [127.0.0.1])
 by metalevel.at (Postfix) with ESMTP id B8B4EA03CB
 for <bug-gnu-emacs@HIDDEN>; Sat, 25 May 2019 15:23:48 +0200 (CEST)
Received: by mt-Lenovo-ideapad-120S-11IAP (Postfix, from userid 1000)
 id 7704E14128F; Sat, 25 May 2019 15:23:48 +0200 (CEST)
From: Markus Triska <triska@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 26.1; line-beginning-position sometimes does not yield line beginning
 position
Date: Sat, 25 May 2019 15:23:48 +0200
Message-ID: <878suullaz.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 78.46.218.83
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)


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




Acknowledgement sent to Markus Triska <triska@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#35898; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.