]> git.eshelyaron.com Git - emacs.git/commitdiff
Set marker insertion type for Imenu markers
authorMorgan Willcock <morgan@ice9.digital>
Wed, 25 Dec 2024 09:47:42 +0000 (09:47 +0000)
committerEshel Yaron <me@eshelyaron.com>
Fri, 27 Dec 2024 15:38:01 +0000 (16:38 +0100)
* 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.  (Bug#75072)

(cherry picked from commit dc4b8d198bab5363e139853f656ff553dcdeeeb5)

lisp/imenu.el

index 47fa73bc4eadbfd658a868761ba3b96f2585ecb4..1d6e70960cba3cadf9c8d8d9f69aa469b47d8c5a 100644 (file)
@@ -550,7 +550,9 @@ The alternate method, which is the one most often used, is to call
             (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.
@@ -655,7 +657,7 @@ depending on PATTERNS."
                (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)