Q: How can I delete a marker after it has been created?
I see how to create markers and how to move markers, but I see nothing in the manual about how to delete them:
Q: How can I delete a marker after it has been created?
I see how to create markers and how to move markers, but I see nothing in the manual about how to delete them:
Markers that point nowhere are garbage-collected. From the Elisp manual, node Overview of Markers:
Insertion and deletion in a buffer must check all the markers and relocate them if necessary. This slows processing in a buffer with a large number of markers. For this reason, it is a good idea to make a marker point nowhere if you are sure you don’t need it any more. Markers that can no longer be accessed are eventually removed (*note Garbage Collection::).
To make a marker point nowhere, use set-marker
to set it to nil
:
(set-marker my-marker nil)
Is that not enough for you? Can you explain why you want to explicitly (i.e., immediately) delete a marker?