From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#35899: 26.1; move-beginning-of-line sometimes does not move to beginning of line Date: Fri, 21 Jun 2019 06:05:22 -0400 Message-ID: <871rznw8wt.fsf@gmail.com> References: <875zpylkxe.fsf@metalevel.at> <838suu4n1y.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="66045"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: 35899@debbugs.gnu.org, Markus Triska To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 21 12:07:36 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.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1heGSG-000H1w-6i for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Jun 2019 12:07:36 +0200 Original-Received: from localhost ([::1]:57916 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1heGSF-0008OW-6u for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Jun 2019 06:07:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56079) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1heGQo-0006i7-Le for bug-gnu-emacs@gnu.org; Fri, 21 Jun 2019 06:06:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1heGQl-0003FX-JT for bug-gnu-emacs@gnu.org; Fri, 21 Jun 2019 06:06:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36141) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1heGQl-0003FQ-Gi for bug-gnu-emacs@gnu.org; Fri, 21 Jun 2019 06:06:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1heGQj-0007YS-LJ for bug-gnu-emacs@gnu.org; Fri, 21 Jun 2019 06:06:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 21 Jun 2019 10:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35899 X-GNU-PR-Package: emacs Original-Received: via spool by 35899-submit@debbugs.gnu.org id=B35899.156111153329004 (code B ref 35899); Fri, 21 Jun 2019 10:06:01 +0000 Original-Received: (at 35899) by debbugs.gnu.org; 21 Jun 2019 10:05:33 +0000 Original-Received: from localhost ([127.0.0.1]:49685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1heGQG-0007Xk-Hc for submit@debbugs.gnu.org; Fri, 21 Jun 2019 06:05:32 -0400 Original-Received: from mail-io1-f43.google.com ([209.85.166.43]:42415) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1heGQF-0007XW-0A for 35899@debbugs.gnu.org; Fri, 21 Jun 2019 06:05:31 -0400 Original-Received: by mail-io1-f43.google.com with SMTP id u19so1525196ior.9 for <35899@debbugs.gnu.org>; Fri, 21 Jun 2019 03:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=RZbL48F2w107lu6ejP2Ls84mfNb5m164A7o3s+iDoFM=; b=fmfmrhXbRvq0Wo7EI7ouW3gCANELm2DHMy2QatEAtIRvv8h4FRC3ef4WJrRLCp5GPc z9IC5FQSCnyNb0ZbA4T4zO7co+I3TEyr9j6eZ6cR60CUG8PuaxPsWyCFn9bToMZ8nAwW Rlv2l7N8F9h2FsxM+SbIG1+N2raLF9XfawsgpLEp+PE6UAIzNEtVS3T4tOg1D9d+rlsv 17AyILfQCocxz7yBGYnkf4GFkfPn+0KBY4GZzuizPHq8v6W+rYtSMJtQhoixvf2nH1TS VSR9hdFvbAABp7jZeF3M5Lo+0nAv/0jmEt9wNm5ciaw4yMQOlav8NkJcM/cfkIrRh6ij /44A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=RZbL48F2w107lu6ejP2Ls84mfNb5m164A7o3s+iDoFM=; b=E23AqFUbRiktrmKQuo8PBsXeI6/TH3peF9OEUXhHEtwEQFZPRZkQbMJnTchbZDvyIc n8mglYkyS1MkjpZdOJZmGj6MVzhqo2vvg4vibXmCsX4MEPQnsRuM9iIQFr2AOFljL678 +AVWlB1hxkWRr/JDs+cg3F4K3M50g5VxdDHnX5E8Qhvn8v3gnHQDhVkoMKNkzCuOkDH1 9X1HpAx4sxOdR1BbycohOj8u5LRTWtQSOcR9FM00ilA9/TYqoqUMJ83A04LFA4u7XwXg cg8NukCPzhDxo1AJ+tF2B1Eic6w4LzUHSjRHj9ujQGsmYFVdycuVKMy1mf07qmrJ0NDG /VKw== X-Gm-Message-State: APjAAAUGI202ZU20VEyKAkNAmw4HhKuJQtsY/W6KFRXTWfw1M0/+yr/M tkK83jE9RTL8qRASttkUxvyOZRSL X-Google-Smtp-Source: APXvYqz3Z46fz8cTdAp7b3Kqb2aoEcCFJRLBsJnxYTSCy7TN9RhMMDKxIG4b4SQ4vd+cQEBMtzVHeg== X-Received: by 2002:a5e:890f:: with SMTP id k15mr595613ioj.121.1561111525165; Fri, 21 Jun 2019 03:05:25 -0700 (PDT) Original-Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id y17sm2892449ioa.40.2019.06.21.03.05.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Jun 2019 03:05:24 -0700 (PDT) In-Reply-To: <838suu4n1y.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 25 May 2019 17:38:01 +0300") 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:160930 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> However, the documentation of move-beginning-of-line includes: >>=20 >> (If there=E2=80=99s an image in the line, this disregards newlines >> which are part of the text that the image rests on.) >>=20 >> Hence, I expect this to move to position 1. For comparison, when I press >> C-a, it does move to position 1, as expected. > > "the text that the image rests on" refers to the text which is > "covered" by the display property, not the newlines in the binary data > that constitutes the image file's data. If I create an image which rests on some newlines like this: (let ((img (create-image "bug-35899-hello.png"))) (insert "abc") (insert-image img "foo\nbar\nbaz") (insert "def")) Then with point after "def", move-beginning-of-line stops "inside" the image. And I don't see anything in its code which would allow it to skip the image. Isn't this just a doc bug? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Clarify-docs-about-line-movement-Bug-35899.patch Content-Description: patch >From f64d539780c0aa8e1a3322afa518eb768f468e16 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Fri, 21 Jun 2019 05:52:14 -0400 Subject: [PATCH] Clarify docs about line movement (Bug#35899) * doc/lispref/positions.texi (Text Lines, Screen Lines): Add index entries. * lisp/simple.el (move-beginning-of-line): Remove incorrect mention of images, and reference beginning-of-visual-line. * src/editfns.c (Fline_beginning_position): Reference `vertical-motion'. --- doc/lispref/positions.texi | 3 +++ lisp/simple.el | 8 ++++---- src/editfns.c | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index 7707793467..128685800f 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi @@ -332,6 +332,8 @@ Buffer End Motion @node Text Lines @subsection Motion by Text Lines @cindex lines +@cindex logical lines, moving by +@cindex physical lines, moving by Text lines are portions of the buffer delimited by newline characters, which are regarded as part of the previous line. The first text line @@ -515,6 +517,7 @@ Text Lines @node Screen Lines @subsection Motion by Screen Lines @cindex screen lines, moving by +@cindex visual lines, moving by The line functions in the previous section count text lines, delimited only by newline characters. By contrast, these functions count screen diff --git a/lisp/simple.el b/lisp/simple.el index a0f2da7152..010a7ae563 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -6638,15 +6638,15 @@ (defun move-end-of-line (arg) (setq done t))))))) (defun move-beginning-of-line (arg) - "Move point to beginning of current line as displayed. -\(If there's an image in the line, this disregards newlines -which are part of the text that the image rests on.) + "Move point to visible beginning of current logical line. +This disregards any invisible newline characters. With argument ARG not nil or 1, move forward ARG - 1 lines first. If point reaches the beginning or end of buffer, it stops there. \(But if the buffer doesn't end in a newline, it stops at the beginning of the last line.) -To ignore intangibility, bind `inhibit-point-motion-hooks' to t." +To ignore intangibility, bind `inhibit-point-motion-hooks' to t. +For motion by visual lines, see `beginning-of-visual-line'." (interactive "^p") (or arg (setq arg 1)) diff --git a/src/editfns.c b/src/editfns.c index 9b76ae23ff..7e16fbd0ed 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -910,7 +910,8 @@ DEFUN ("line-beginning-position", This function ignores text display directionality; it returns the position of the first character in logical order, i.e. the smallest -character position on the line. +character position on the logical line. See `vertical-motion' for +movement by screen lines. This function constrains the returned position to the current field unless that position would be on a different line than the original, -- 2.11.0 --=-=-=--