GNU bug report logs - #76167
31.0.50; view-mode un-expected jump-overs

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: Tomas Nordin <tomasn@HIDDEN>; Keywords: confirmed patch; dated Sun, 9 Feb 2025 22:10:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Added tag(s) confirmed. Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 76167) by debbugs.gnu.org; 24 Feb 2025 20:30:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 24 15:30:27 2025
Received: from localhost ([127.0.0.1]:42917 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tmf5u-0000jz-Mo
	for submit <at> debbugs.gnu.org; Mon, 24 Feb 2025 15:30:27 -0500
Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:43281)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1tmf5r-0000jb-9r
 for 76167 <at> debbugs.gnu.org; Mon, 24 Feb 2025 15:30:24 -0500
Received: by mail-ed1-x52e.google.com with SMTP id
 4fb4d7f45d1cf-5dee1626093so10628413a12.1
 for <76167 <at> debbugs.gnu.org>; Mon, 24 Feb 2025 12:30:23 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740429017; x=1741033817; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=lreT+WLZXlFNlpJQDX4vJlHzQsm5fCuNW06SCxobH4A=;
 b=aQIWRaYCCh25Bv6LGK2QUahV2SGvNLXLlC7dBLtmyRfoYQP3/u/YsBB5KNv1+Hmhm9
 XzxXQwIwMVbGgfi+OkUd7ceIG90afIPKdTwlTA8WVl+vFDoqNCzhe4C34dHem/XeFQm3
 4I56Xwm2zqr0j0jjoECFV0y+Vo7LO++ZLdayFAWmCRY7xz32kjeIZe6mbnZtyCKkqkC3
 EVfcd7cEQq3L6s3vfI5jSEAOKIFD/OitFm31ITPhjDm/LY8yPcbczldw4FqIBz2jJOBJ
 hEMTkxDmxjo1tYDD4piZvlX/vEoMhREDswzn1S7wdAwAN3Nch4cAfPaJoguXZE52Y37l
 F8/A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740429017; x=1741033817;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=lreT+WLZXlFNlpJQDX4vJlHzQsm5fCuNW06SCxobH4A=;
 b=kqUeZ9nJdpi5aXNZCB2UGUGJLopO11d8194GTuE2kibCbj/6zt5xzW3lEawdtBHuBP
 AdHzGaL7ncWITrRRygQycOkpciGN8bA/B5GKxNg+n2WCa3VuBqLbg193rgQhKsbfwtC1
 qADn6cHGzqh6Wy2XWHm/7miTtlMm/VidFXawSHszb9o/hMypZO0ojrYnO2YVklNga9GK
 hOo6k71+Qe5Y5AWdJZz+FeQus1bUNbrf7sM0aJJIBwSRjYzNQczwRVAYODQP73iY4kpw
 91bnRtyD5FkKu3euvJPfPZwnDuLWYwgfhueHTBDYmN5gvawQW9YyV/U83SlugdybmohZ
 QrWQ==
X-Gm-Message-State: AOJu0Yzxxal5QnRyOo75xqG6G1NBZ3ZnwHUbygOSQFfKlV+0Bf1J3+Qm
 2jHnfz1Vla41m0gkjN2L1Z7q5J4uNBGKpSxu2m+qZvMCJJoHc/xQ+ZZBgURnZTOWLzHxZnnnR98
 e+pHWU+NIiQwxJydMFdDAsGr8oXVMP3LSFTA=
X-Gm-Gg: ASbGnctM0vNGuLIwUUlw2BhTjtqk7hMlWhs2fWtyvbU+oynfGWOcV7LY8eTulOR26gP
 1FppkRuHBKu2cjvC35Y14TvroBZs7xK7KEatka97RjyWE+zjX7ufH5AD+DFRQVLgvzT+zoIjSBl
 1vRWBgbzS+XQ==
X-Google-Smtp-Source: AGHT+IHdLegfo5075f9yZyLcgikDLwE0tGHAg7HmzxEHNOVAHHrtbKEELR1ibDoLjdbmQNaZBjkp6avSQvfGXdVTMH0=
X-Received: by 2002:a05:6402:358f:b0:5de:5cb3:e82a with SMTP id
 4fb4d7f45d1cf-5e0a1116e25mr20455144a12.0.1740429016511; Mon, 24 Feb 2025
 12:30:16 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Mon, 24 Feb 2025 14:30:15 -0600
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <86tt8mjpj0.fsf@HIDDEN>
References: <875xli22jd.fsf@HIDDEN> <86tt8mjpj0.fsf@HIDDEN>
MIME-Version: 1.0
Date: Mon, 24 Feb 2025 14:30:15 -0600
X-Gm-Features: AWEUYZnxuze3w4p2zVAO49Z75V2S402JwyeEQ2nGR4RNGfA7C27nuqxmf4PIvOM
Message-ID: <CADwFkmnSL0ZogPeGSiEVPA74Tg+Gj6EvOM=R+mTDyHpfA4y0Zw@HIDDEN>
Subject: Re: bug#76167: 31.0.50; view-mode un-expected jump-overs
To: Eli Zaretskii <eliz@HIDDEN>, Tomas Nordin <tomasn@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76167
Cc: 76167 <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: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Tomas Nordin <tomasn@HIDDEN>
>> Date: Sun, 09 Feb 2025 22:09:42 +0000
>>
>> View-mode has less like features like View-search-regexp-forward (/) and
>> View-search-last-regexp-forward (n). Using them I do some un-expected
>> observations. Here is a repro:
>>
>> $ echo 1 word > words
>> $ echo 2 >> words
>> $ for n in $(seq 3 6); do echo $n word >> words; done
>> $ emacs -Q words
>> M-x view-mode
>> / word
>> n                               ; until on line 6
>> p                               ; as far up as possible
>>
>> The observation is that searching backwards jumps over every second
>> search hit when matches occur on consecutive lines.
>>
>> Now do
>>
>> / !drow
>>
>> And play with n and p. The bang tells to match every line that does
>> not match the regex. Again every second expected match is "jumped"
>> over. In this case also when searching forward. (Expected is that
>> every line is a search hit).
>>
>> Maybe not many people use view-mode and it's less-like search
>> features, and so this was never complained about.
>>
>> I find that the attached patch solves the problem. What do you think?
>
> Thanks.
>
> I don't use view-mode that much, so I don't have an opinion on this
> behavior change.  Could people who use view-mode please chime in and
> voice their opinions?

I agree that it just looks like a bug.  It does seem strange that we
didn't catch it before.

The patch works here, and I don't see anything obviously wrong with it.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76167; Package emacs. Full text available.
Added tag(s) patch. Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 76167) by debbugs.gnu.org; 22 Feb 2025 09:29:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 22 04:29:49 2025
Received: from localhost ([127.0.0.1]:47530 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tllpV-0004EP-01
	for submit <at> debbugs.gnu.org; Sat, 22 Feb 2025 04:29:49 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:60824)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tllpS-0004DL-VT
 for 76167 <at> debbugs.gnu.org; Sat, 22 Feb 2025 04:29:47 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tllpN-00050l-G0; Sat, 22 Feb 2025 04:29:41 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Qh7ZmUAO3DByl7f7uLef4tOT68DmTBMLPEBvphsmZHA=; b=aQIHrJ0TlSwy
 XMrg4MT1bZGp+BuRmhXi+G5EhOPruRYopG3i4WOAalF31xTkuPnQSHlQBhx11B+3bqe88/fkmh5Ef
 kK9CyG1eW9Urd9CKye8EELJgvZgKmF4/TLncrgihABtQThDvmB6c/mb+S8a6pWnQVDg60SWs0T+0Q
 JJ0LSdVytdSX1v6JzJ3plycl5Q4bLmJMU5MTjB8fyCvgzLKZtQ3lyCL5SK6Y9iJ0Te1iZme6Ya4Y0
 UDpfhWf3gYCFp8HkNPxGUz81njYh1nPkICmk9jTnYqE4WO6idqZKLgI839A276kV1of8Bl3GMFV7F
 6q3pN3F3YyMLQ6OMDuL5OQ==;
Date: Sat, 22 Feb 2025 11:29:39 +0200
Message-Id: <86tt8mjpj0.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Tomas Nordin <tomasn@HIDDEN>
In-Reply-To: <875xli22jd.fsf@HIDDEN> (message from Tomas Nordin on Sun, 09
 Feb 2025 22:09:42 +0000)
Subject: Re: bug#76167: 31.0.50; view-mode un-expected jump-overs
References: <875xli22jd.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76167
Cc: 76167 <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: Tomas Nordin <tomasn@HIDDEN>
> Date: Sun, 09 Feb 2025 22:09:42 +0000
> 
> View-mode has less like features like View-search-regexp-forward (/) and
> View-search-last-regexp-forward (n). Using them I do some un-expected
> observations. Here is a repro:
> 
> $ echo 1 word > words
> $ echo 2 >> words
> $ for n in $(seq 3 6); do echo $n word >> words; done
> $ emacs -Q words
> M-x view-mode
> / word
> n                               ; until on line 6
> p                               ; as far up as possible
> 
> The observation is that searching backwards jumps over every second
> search hit when matches occur on consecutive lines.
> 
> Now do
> 
> / !drow
> 
> And play with n and p. The bang tells to match every line that does
> not match the regex. Again every second expected match is "jumped"
> over. In this case also when searching forward. (Expected is that
> every line is a search hit).
> 
> Maybe not many people use view-mode and it's less-like search
> features, and so this was never complained about.
> 
> I find that the attached patch solves the problem. What do you think?

Thanks.

I don't use view-mode that much, so I don't have an opinion on this
behavior change.  Could people who use view-mode please chime in and
voice their opinions?




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

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


Received: (at submit) by debbugs.gnu.org; 9 Feb 2025 22:10:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 09 17:10:01 2025
Received: from localhost ([127.0.0.1]:46748 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1thFV2-0002ij-Hl
	for submit <at> debbugs.gnu.org; Sun, 09 Feb 2025 17:10:00 -0500
Received: from lists.gnu.org ([2001:470:142::17]:41538)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <tomasn@HIDDEN>) id 1thFUz-0002iV-MC
 for submit <at> debbugs.gnu.org; Sun, 09 Feb 2025 17:09:58 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tomasn@HIDDEN>) id 1thFUu-0003wq-9J
 for bug-gnu-emacs@HIDDEN; Sun, 09 Feb 2025 17:09:52 -0500
Received: from mout02.posteo.de ([185.67.36.66])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <tomasn@HIDDEN>) id 1thFUq-0001fb-OQ
 for bug-gnu-emacs@HIDDEN; Sun, 09 Feb 2025 17:09:52 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id B7567240101
 for <bug-gnu-emacs@HIDDEN>; Sun,  9 Feb 2025 23:09:44 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1739138984; bh=X3va6PftT41u+RbUuLZxpqU2zaGiArwE+qkHjcqa63I=;
 h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From;
 b=LS+Q33cb4H3RFiSlYvXUSG5UJ6VmwIVb80LJCf3rxwAorwfXIOlgGgziKp+vr/p8S
 EHX66YX1IpBQALQDXGvonL8hMU5S2Ui9F48OzSlxRsB2ibZrmKvV/zONlyLASZPu5b
 3x3BP0fnrJ4DRvb0oT7MG7SzeEqhwQ/8svOiQW3hgARCtFac5m2R7y/R/dCQg7Vm9e
 hj+vwnqU4ZRU8UGoTiwfVW9Q/Fz9QLZkov8pvwFqWuyRjm8wkry5AsfXe6TRC/162k
 GAMeDuVqj8cPMCOc/kYHFYsghYFf6syzVf3zWtu1WWST9nZLcuoH+VojGa+ZrgeQb3
 03WrjnAq7O7WA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4YrhhS18Lbz6tsg
 for <bug-gnu-emacs@HIDDEN>; Sun,  9 Feb 2025 23:09:43 +0100 (CET)
From: Tomas Nordin <tomasn@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 31.0.50; view-mode un-expected jump-overs
X-Debbugs-Cc: 
Date: Sun, 09 Feb 2025 22:09:42 +0000
Message-ID: <875xli22jd.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=185.67.36.66; envelope-from=tomasn@HIDDEN;
 helo=mout02.posteo.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
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: -0.0 (/)

--=-=-=
Content-Type: text/plain

Hello

View-mode has less like features like View-search-regexp-forward (/) and
View-search-last-regexp-forward (n). Using them I do some un-expected
observations. Here is a repro:

$ echo 1 word > words
$ echo 2 >> words
$ for n in $(seq 3 6); do echo $n word >> words; done
$ emacs -Q words
M-x view-mode
/ word
n                               ; until on line 6
p                               ; as far up as possible

The observation is that searching backwards jumps over every second
search hit when matches occur on consecutive lines.

Now do

/ !drow

And play with n and p. The bang tells to match every line that does
not match the regex. Again every second expected match is "jumped"
over. In this case also when searching forward. (Expected is that
every line is a search hit).

Maybe not many people use view-mode and it's less-like search
features, and so this was never complained about.

I find that the attached patch solves the problem. What do you think?

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.16.0) of 2025-02-09 built on fliptop2
Repository revision: 7e60ceeccbca1b9f67297ad7e9f11fd498b28d4d
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Start-search-from-beginning-or-end-of-line.patch

From 130cf266748c16601041990e49335b9e828a0c54 Mon Sep 17 00:00:00 2001
From: Tomas Nordin <tomasn@HIDDEN>
Date: Sun, 9 Feb 2025 22:39:58 +0100
Subject: [PATCH] Start search from beginning or end of line

* lisp/view.el (view-search):
Go to beginning-of-line or end-of-line instead of previous or
next line before the search.
---
 lisp/view.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/view.el b/lisp/view.el
index dc157d8996a..e1d6fb74c79 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -885,7 +885,8 @@ view-search
      (t (error "No previous View-mode search")))
     (save-excursion
       (if end (goto-char (if (< times 0) (point-max) (point-min)))
-	(forward-line (if (< times 0) -1 1)))
+        (if (< times 0) (beginning-of-line)
+          (end-of-line)))
       (if (if no (view-search-no-match-lines times regexp)
 	    (re-search-forward regexp nil t times))
 	  (setq where (point))))
-- 
2.39.5


--=-=-=--




Acknowledgement sent to Tomas Nordin <tomasn@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#76167; 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, 24 Feb 2025 22:15:01 UTC

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