From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Morgan Willcock Newsgroups: gmane.emacs.bugs Subject: bug#75072: [PATCH] Set marker insertion type for Imenu markers Date: Wed, 25 Dec 2024 10:02:53 +0000 Message-ID: <87pllg13n6.fsf@ice9.digital> References: <87ldw4664f.fsf@ice9.digital> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17618"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 75072@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 25 11:04:15 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 1tQOFS-0004R3-LJ for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Dec 2024 11:04:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQOFK-0001nx-H3; Wed, 25 Dec 2024 05:04:06 -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 1tQOFH-0001ni-Si for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 05:04:04 -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 1tQOFH-00070H-H3 for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 05:04:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=b78548KYUJA5Cb0xDQH+mrYIsCTZtDuxv4B20A2TtMU=; b=oiWlkQUnqm4UlfrQMSi7ZeF3lCKX7Ft8a5vOy8IlOvw8QvpUT6uJATeGJ/LwFCtSxcSvnsX158hjoJGgtYLh+XqJ2dSJ6wXqBoiI86nQ4VwxmmOgxNOU0HheWfUWHyoj4R6PzqfLHGxlbw7T9G2ZVjcvz1D/uZQxNbndPlkra9ozTi7ckxLQ1IC9dF1dSAD5IC07JYU8x9bXE733OIPSWxO4fVOoJ/uB8Sui+W5v8ETgFlC+F87l94DUuvSq6Yr/603JA1Qx4363YL7KA+mmS/cUL7nqdMmRtCQAN1WoV6zrBOlUMzvK+yZBhCQftGxcx1dJBPmSyZhFdCgKemZN0Q==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQOFG-0002x9-Eh for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 05:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Morgan Willcock Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Dec 2024 10:04: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.173512098611265 (code B ref 75072); Wed, 25 Dec 2024 10:04:02 +0000 Original-Received: (at 75072) by debbugs.gnu.org; 25 Dec 2024 10:03:06 +0000 Original-Received: from localhost ([127.0.0.1]:36235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQOEM-0002vd-36 for submit@debbugs.gnu.org; Wed, 25 Dec 2024 05:03:06 -0500 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:34557) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQOEI-0002v4-Rs for 75072@debbugs.gnu.org; Wed, 25 Dec 2024 05:03:04 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 4528B1C0004 for <75072@debbugs.gnu.org>; Wed, 25 Dec 2024 10:02:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ice9.digital; s=gm1; t=1735120976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=b78548KYUJA5Cb0xDQH+mrYIsCTZtDuxv4B20A2TtMU=; b=J+63P0+CKS7oSCutuyqTNP7IVJUkvtRQKa7zqJM4QmHZ8BMNp4Ds707PCMwmvc4INXyvaT UUjWq7YGBNNe8Ek+ZRKEnLwpyKUcfuExIyVflSFV6iJ/zPkAw8RLBHtlUAjNeeT5SL9+eS MtuGlyQxirNbLS3E3uEXaXnuVlFLluRy4poVz05wuD6armDF9N8iq0Ff1tPu5YKmHhjNzp 7ORk3viCLf4vBzkP/A9ErMn6mV9IiM9RrdXCTvaicNESj04GOic5+t6GCvy3HjBgOOMqEy vB4TTS7ohu3t1mFvN+rruREMZAFQ1N6SWQVxRcFJ4Qec98Zif4XVPEVMSC1Afw== In-Reply-To: <87ldw4664f.fsf@ice9.digital> (Morgan Willcock's message of "Tue, 24 Dec 2024 22:58:08 +0000") X-GND-Sasl: morgan@ice9.digital 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:297726 Archived-At: --=-=-= Content-Type: text/plain I hadn't realised that copy-marker could be used to create a marker and set the insertion type in a single step. Attached is a replacement patch which uses copy-marker and also makes the same change for Imenu markers created by imenu-generic-expression. -- Morgan Willcock --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Set-marker-insertion-type-for-Imenu-markers.patch >From 7b3767d5ed824b8a5f347bf46001917008173fe0 Mon Sep 17 00:00:00 2001 From: Morgan Willcock Date: Wed, 25 Dec 2024 09:47:42 +0000 Subject: [PATCH] Set marker insertion type for Imenu markers * lisp/imenu.el (imenu-default-create-index-function) (imenu--generic-function): Configure Imenu markers to advance their position when characters are inserted at the marker position. --- lisp/imenu.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/imenu.el b/lisp/imenu.el index ba1ba5fcd00..12bc89cb159 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -583,7 +583,9 @@ imenu-default-create-index-function (and (stringp name) ;; [ydi] Updated for imenu-use-markers. (push (cons name - (if imenu-use-markers (point-marker) (point))) + (if imenu-use-markers + (copy-marker (point) t) + (point))) index-alist))) index-alist)) ;; Use generic expression if possible. @@ -688,7 +690,7 @@ imenu--generic-function (unless (assoc menu-title index-alist) (push (list menu-title) index-alist)) (if imenu-use-markers - (setq beg (copy-marker beg))) + (setq beg (copy-marker beg t))) (let ((item (if function (nconc (list (match-string-no-properties index) -- 2.47.1 --=-=-=--