From unknown Sun Sep 07 15:58:49 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35898: 26.1; line-beginning-position sometimes does not yield line beginning position Resent-From: Markus Triska Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 May 2019 13:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 35898 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 35898@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.155879065116100 (code B ref -1); Sat, 25 May 2019 13:25:01 +0000 Received: (at submit) by debbugs.gnu.org; 25 May 2019 13:24:11 +0000 Received: from localhost ([127.0.0.1]:48406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hUWeh-0004Bb-0t for submit@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 ) id 1hUWef-0004BL-BQ for submit@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 ) id 1hUWea-0007tz-8J for submit@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 ) id 1hUWeZ-0008WH-2m for bug-gnu-emacs@gnu.org; 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 ) id 1hUWeX-0007sw-V8 for bug-gnu-emacs@gnu.org; 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 ) id 1hUWeX-0007pr-Ov for bug-gnu-emacs@gnu.org; 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 ; 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 Date: Sat, 25 May 2019 15:23:48 +0200 Message-ID: <878suullaz.fsf@metalevel.at> 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 From unknown Sun Sep 07 15:58:49 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35898: 26.1; line-beginning-position sometimes does not yield line beginning position 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 X-GNU-PR-Keywords: To: Markus Triska Cc: 35898@debbugs.gnu.org Received: via spool by 35898-submit@debbugs.gnu.org id=B35898.155879287120838 (code B ref 35898); Sat, 25 May 2019 14:02:01 +0000 Received: (at 35898) by debbugs.gnu.org; 25 May 2019 14:01:11 +0000 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 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 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 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 Date: Sat, 25 May 2019 17:01:01 +0300 Message-Id: <83blzq4orm.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <878suullaz.fsf@metalevel.at> (message from Markus Triska on Sat, 25 May 2019 15:23:48 +0200) References: <878suullaz.fsf@metalevel.at> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > 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. From unknown Sun Sep 07 15:58:49 2025 X-Loop: help-debbugs@gnu.org Subject: bug#35898: 26.1; line-beginning-position sometimes does not yield line beginning position Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Aug 2020 00:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35898 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 35898@debbugs.gnu.org, Markus Triska Received: via spool by 35898-submit@debbugs.gnu.org id=B35898.15984034397799 (code B ref 35898); Wed, 26 Aug 2020 00:58:02 +0000 Received: (at 35898) by debbugs.gnu.org; 26 Aug 2020 00:57:19 +0000 Received: from localhost ([127.0.0.1]:36711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAjkd-00021h-1q for submit@debbugs.gnu.org; Tue, 25 Aug 2020 20:57:19 -0400 Received: from mail-yb1-f193.google.com ([209.85.219.193]:41507) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAjkV-000215-F7 for 35898@debbugs.gnu.org; Tue, 25 Aug 2020 20:57:11 -0400 Received: by mail-yb1-f193.google.com with SMTP id s195so12744ybc.8 for <35898@debbugs.gnu.org>; Tue, 25 Aug 2020 17:57:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:user-agent :mime-version:date:message-id:subject:to:cc; bh=ugShx89ksxqTIn/Ht6T3EWIS1qNRmZjweu7pihrrsDA=; b=s3nAwfwTJVwkfA5586gFyjzVRYiWPZHRkYrX6jCDBVNJZ5+o0R0v4BjqTeousGlz6b uOxDebdunahaA6SEB3KRPmJJJqgAOB7RYXk3kIjrGa2Ks8o+7Snd1EHJWsCf/m2nIKA4 Q8hQUiIyEv6KP/0vZD0nPxefuPqPq6w/7B7AOxrkDxRBg/BpohJ+rqg6hy5IudtKxrdy 03WZop79lISgU18tGIDXlrhmeDNC9t+3j/kn6t/4TNUqMun6bdRDAJ5saUGxKHikr7+M R7b74KXWatmshwRE6PM/0I06ded3wtlvnxSI2omRWYgRmycpAgXqpFap8n+qjux2F0Ic 3NKA== X-Gm-Message-State: AOAM532vRH6Jj2eBBnTBOn463nxAc4g+XmUh81NfI5QJkCeL+RNP8JVG cO5cTTEWKkDTTO56Q6PDwLAmitSXo+bRE9U90Yo= X-Google-Smtp-Source: ABdhPJxNbVIBFtYDhm0EKY7XhkyYTHVzxp1S+ChOir7MkmD3tucHV3Ai3/h3uFhYyPx8oCNaNz3VADW30ynNO8TvGWs= X-Received: by 2002:a25:4ed7:: with SMTP id c206mr19037559ybb.129.1598403425954; Tue, 25 Aug 2020 17:57:05 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 25 Aug 2020 17:57:05 -0700 From: Stefan Kangas In-Reply-To: <83blzq4orm.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 25 May 2019 17:01:01 +0300") References: <878suullaz.fsf@metalevel.at> <83blzq4orm.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Date: Tue, 25 Aug 2020 17:57:05 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) tags 35898 + notabug close 35898 thanks Eli Zaretskii writes: >> 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. 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