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#75072: [PATCH] Set marker insertion type for Imenu markers Date: Wed, 25 Dec 2024 14:00:18 +0200 Message-ID: <86pllg0y7h.fsf@gnu.org> References: <87ldw4664f.fsf@ice9.digital> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22548"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 75072@debbugs.gnu.org To: Morgan Willcock Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 25 13:01:29 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 1tQQ4v-0005j0-J1 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Dec 2024 13:01:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQQ4W-0000jv-Ct; Wed, 25 Dec 2024 07:01:04 -0500 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 1tQQ4V-0000je-8h for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 07:01:03 -0500 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 1tQQ4U-000400-FY for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 07:01:03 -0500 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=tCRHRskIil6AsgskObHxPckoYAexXFIcFnQHJQFW/sc=; b=Q3P828f6V14TLadI8Z+VVS0K7a6Ucwfhl/dTGXq+L+8XYTKagVmmdcXTYn+7M9Quvnyh/KEb1NJuAi9T2KPVv8onAqeKdrv+lBW6Gjm4s5p6pKGV2f/a6CsbGFDLHsAb/gxKHX4/AUh9WCr9YJ9gBRob01TmNaYlOaZ1jZScqK4vwPcH7lvipjeeZxM1U1clcLD+pPXoRcQ2OJEzFw5X34HmNrqIlfVAqflSUFLq/9mEKol6ae/Sjc/j3NV3Rqh/C/aFqDVD7hnikctxQ6sVzcdQsjVMOBGg/vDd61zaMUfOYmHyPpozPWLIh9JMHlvUNDqZT1b94DqqAOkTLWem/g==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQQ4U-000095-9d for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 07:01:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Dec 2024 12:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75072 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 75072-submit@debbugs.gnu.org id=B75072.1735128040490 (code B ref 75072); Wed, 25 Dec 2024 12:01:02 +0000 Original-Received: (at 75072) by debbugs.gnu.org; 25 Dec 2024 12:00:40 +0000 Original-Received: from localhost ([127.0.0.1]:36419 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQQ48-00007q-F8 for submit@debbugs.gnu.org; Wed, 25 Dec 2024 07:00:40 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQQ46-00007a-1i for 75072@debbugs.gnu.org; Wed, 25 Dec 2024 07:00:38 -0500 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 1tQQ3v-0003rM-W8; Wed, 25 Dec 2024 07:00:32 -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=tCRHRskIil6AsgskObHxPckoYAexXFIcFnQHJQFW/sc=; b=qjQZU40FA5dI BnU5FMspBfQY7a4shgXrl/Bpm49gAzt1w6Xarn41C+3IsXWy3/A8Dnd1saMlyv7HC5Nr8zOe2VhEj RohFzGT0bjCEDTm1qt6c/bQvyBf+18O/kQcsxjEs5YYZA50zNOo3i+0IPNELaNkZBHP77UuMzs0eo SaHrKMOceFSPXEf/AEzQVOdKHjUD3gj/cjwk6Aa8LOh45a5C4QFfHRerBcC2Nsh4lneplPcLX+Tom hvi5qas1Ef7Gut3vAs27SEqv4XCmz4dkU71S4Uq9/3S68tZuEgJrz72gtvnznnb57dQT9te4+Ya5m LbiwqIrPjDK5JvRsJxKAig==; In-Reply-To: <87ldw4664f.fsf@ice9.digital> (message from Morgan Willcock on Tue, 24 Dec 2024 22:58:08 +0000) 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:297729 Archived-At: > From: Morgan Willcock > Date: Tue, 24 Dec 2024 22:58:08 +0000 > > The internal Imenu function for creating an Imenu index uses markers by > default, but the marker insertion type is left at the default type which > does not advance the marker position when additional characters are > inserted at the marker position. Attached is a patch which sets the > marker insertion type to advance the marker position in the same > scenario. > > This change means that the Imenu index will continue to be valid instead > of the marker becoming desynced from the buffer contents, i.e. jumping > to an index position and inserting characters will keep the marker in > the correct place. > > I can't think of a situation where the previous marker behaviour was > intentional, but it is likely that the issue wouldn't be seen by anyone > who sets imenu-auto-rescan to t or in modes which do not use both > imenu-prev-index-position-function and imenu-extract-index-name-function > to create the Imenu index. > > I've assumed this would go on the master branch. Yes. But I have one comment below. > - (if imenu-use-markers (point-marker) (point))) > + (if imenu-use-markers > + (let ((marker (point-marker))) > + (set-marker-insertion-type marker t) > + marker) > + (point))) I think it is cleaner to use copy-marker here.