From: Eli Zaretskii <eliz@gnu.org>
To: Morgan Willcock <morgan@ice9.digital>
Cc: 75072@debbugs.gnu.org
Subject: bug#75072: [PATCH] Set marker insertion type for Imenu markers
Date: Wed, 25 Dec 2024 14:00:18 +0200 [thread overview]
Message-ID: <86pllg0y7h.fsf@gnu.org> (raw)
In-Reply-To: <87ldw4664f.fsf@ice9.digital> (message from Morgan Willcock on Tue, 24 Dec 2024 22:58:08 +0000)
> From: Morgan Willcock <morgan@ice9.digital>
> 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.
prev parent reply other threads:[~2024-12-25 12:00 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
2024-12-26 9:00 ` Eli Zaretskii
2024-12-25 12:00 ` Eli Zaretskii [this message]
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=86pllg0y7h.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=75072@debbugs.gnu.org \
--cc=morgan@ice9.digital \
/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).