From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#72995: 31.0.50; widget-move fails when widget starts at the second character in the buffer Date: Tue, 03 Sep 2024 15:35:29 +0300 Message-ID: <86o7547w4u.fsf@gnu.org> References: <69D92478-019F-4703-95F9-E31DE3FE32C2@codefu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12933"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72995@debbugs.gnu.org To: Dale , Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 03 14:36:30 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1slSlp-0003BG-8N for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 03 Sep 2024 14:36:29 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1slSlP-0008Pp-Qy; Tue, 03 Sep 2024 08:36:03 -0400 Original-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 ) id 1slSlO-0008P4-4L for bug-gnu-emacs@gnu.org; Tue, 03 Sep 2024 08:36:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1slSlN-0006k5-RB for bug-gnu-emacs@gnu.org; Tue, 03 Sep 2024 08:36:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=x1J5A/s4PUEHyzxEb0UQa5UDiFC4m+7+Xd2QU0cNJtM=; b=NyPdcOjc3jTZRPZ/1z6ef0m5eB1jLnTTvuhikr5gqxGRN1/kjgojM3KNZW7JJMX6gXklqD7GY6QnKcsysgUr9MEIe25DTfprJCxgH84xednrkbs/c7WxQBotspm7PDQiQ9wUOoeFAWcAPGcAxr1qsirwjJh+jsoLWMhobNz6hD+uyi962tG9GOIQe3Nfgc/yF+Qq4RNuqC3JGtkZst+f6hA25yGoahHHiT9XeE4KQ/oY9JfMNnayiMTVByrQG866w9dgoWrQD7ukd6y1cb+CGToOcV8N47bZz7yne4PqX58E7RyWZkynz5Ql/udBhufVmP8eUvN20zKZxz5Pdsn1jw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1slSmN-0002Ou-0Y for bug-gnu-emacs@gnu.org; Tue, 03 Sep 2024 08:37:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Sep 2024 12:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72995 X-GNU-PR-Package: emacs Original-Received: via spool by 72995-submit@debbugs.gnu.org id=B72995.17253670179208 (code B ref 72995); Tue, 03 Sep 2024 12:37:02 +0000 Original-Received: (at 72995) by debbugs.gnu.org; 3 Sep 2024 12:36:57 +0000 Original-Received: from localhost ([127.0.0.1]:59356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1slSmG-0002OS-Jz for submit@debbugs.gnu.org; Tue, 03 Sep 2024 08:36:56 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38642) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1slSmE-0002OB-MV for 72995@debbugs.gnu.org; Tue, 03 Sep 2024 08:36:55 -0400 Original-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 ) id 1slSl7-0006gF-Pu; Tue, 03 Sep 2024 08:35:45 -0400 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=x1J5A/s4PUEHyzxEb0UQa5UDiFC4m+7+Xd2QU0cNJtM=; b=aKFe+2E/JW/B qDoGtLbaU8ahPM0wGjpMFDqg70aYRvKRMvNxHyTsM0aMDpDjPM2mZw21G+CKBB8AQVdPaLSvxe52k 9asvi3t3ca5tV9bxeaTWPntk5C0MHDSgiHWgc/+Iw0ZzVyJf6kDOa0RsOCJNsM484NhezgfM1rEEX rC1Rko262Go6Gsc6uNS5X7iGypvXAKJA28HkvOvdND9VCPAru0v76fe/qPVijlYQRBJ/H1UlMrb4H qmP7UD2iH7CfrjgJq4Jf57P6MVS4cd5eA1eeeXXXBJcFhb/pLLBFyTXfNjm2rvQz64vFk/8dPghcU qB5mzB4RG3v2SG03yA057w==; In-Reply-To: <69D92478-019F-4703-95F9-E31DE3FE32C2@codefu.org> (message from Dale on Mon, 2 Sep 2024 23:36:35 -0500) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:291139 Archived-At: > From: Dale > Date: Mon, 2 Sep 2024 23:36:35 -0500 > > I think changes in commit 94dec95 (bug#69943) broke `widget-move' in a customize buffer when trying to move to the first widget in a buffer when that first widget starts at the second character in the buffer. Here's some code to reproduce (tested in IELM): > > (let* ((first-wid (progn (widget-forward 1) (point)))) > (print (format "First widget at %S" first-wid)) > (cl-assert (and (numberp first-wid) (>= first-wid 1))) > (with-current-buffer (customize-group 'editing) > (narrow-to-region (1- first-wid) (point-max)) > (goto-char (point-min)) > (widget-forward 1) > (print (format "Expected to be at %S, point=%S" first-wid (point))))) > > On my Emacs I get: > > "First widget at 33" > > "Expected to be at 33, point=32" > > I think this happens because of this code near the end of `widget-move' (which is called by `widget-forward'): > > (let ((new (widget-tabable-at))) > (while (and (eq (widget-tabable-at) new) (not (bobp))) > (backward-char))) > (unless (bobp) (forward-char))) > > In my test case, as we enter the while loop point is at the start of the first widget (AKA "new"). We are not yet at beginning of buffer, so it moves point back one character. Now we are at beginning of buffer, but that doesn't matter: the `eq' test fails first, and the loop ends. > > However, the `forward-char' never runs because we are indeed at beginning of buffer now. I think this `forward-char' should have been run to put point back on the start of the widget. > > Bug#70594 also recently modified code around here, but I don't *think* that's relevant. > > In case you're wondering, this comes up because I use link-hint[1], which narrows a customize buffer in exactly the way shown above. > > [1]: https://github.com/noctuid/link-hint.el > > Please let me know if I can provide any more information! > > Best regards, > Dale Stephen, could you please look into this?