unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Morgan Willcock <morgan@ice9.digital>
To: 75072@debbugs.gnu.org
Subject: bug#75072: [PATCH] Set marker insertion type for Imenu markers
Date: Wed, 25 Dec 2024 10:02:53 +0000	[thread overview]
Message-ID: <87pllg13n6.fsf@ice9.digital> (raw)
In-Reply-To: <87ldw4664f.fsf@ice9.digital> (Morgan Willcock's message of "Tue,  24 Dec 2024 22:58:08 +0000")

[-- Attachment #1: Type: text/plain, Size: 276 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Set-marker-insertion-type-for-Imenu-markers.patch --]
[-- Type: text/x-patch, Size: 1398 bytes --]

From 7b3767d5ed824b8a5f347bf46001917008173fe0 Mon Sep 17 00:00:00 2001
From: Morgan Willcock <morgan@ice9.digital>
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


  reply	other threads:[~2024-12-25 10:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-24 22:58 bug#75072: [PATCH] Set marker insertion type for Imenu markers Morgan Willcock
2024-12-25 10:02 ` Morgan Willcock [this message]
2024-12-26  9:00   ` Eli Zaretskii
2024-12-25 12:00 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pllg13n6.fsf@ice9.digital \
    --to=morgan@ice9.digital \
    --cc=75072@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).