bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29110: 25.2; Should push-mark allow duplicates?


From: Noam Postavsky
Subject: bug#29110: 25.2; Should push-mark allow duplicates?
Date: Wed, 01 Nov 2017 19:30:24 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)

Pierre Neidhardt <ambrevar@gmail.com> writes:

>>> - It eats up more memory.
>>
>> Seriously?  Bof.
>
> Indeed, bof, that was more of a wink.  I do not know the Emacs standard
> in memory consumption though.
>
> But consider this: with Evil, jumping between two marks (so just
> navigating between them) will duplicate each mark every time.  You might
> argue that this is bad code on Evil's side.  But then high-level
> functions might call the jumping functions in loops...  And so on.

Consider this:

    mark-ring-max is a variable defined in ‘simple.el’.
    Its value is 16

    Documentation:
    Maximum size of mark ring.  Start discarding off end if gets this big.

    You can customize this variable.

global-mark-ring-max is the same idea.

> Regardless, I realize that I failed to formulate a proper query in my
> initial report: Does anybody have a hunch as for why duplicate marks
> could potentially interfere with code manipulating the mark-ring?  See
> the issues on Helm and Evil.

Both threads seem pretty hard to follow.  One thing to note is that
push-mark resets markers before discarding (so that they no longer point
to any buffer).  Maybe Helm or Evil keep another reference to a
discarded marker, and try to use it without checking?  If you have a way
to reproduce the problem, you can check if bumping up mark-ring-max to a
very large number has any effect.

    (defun push-mark (&optional location nomsg activate)
       ...
        (when (> (length mark-ring) mark-ring-max)
          (move-marker (car (nthcdr mark-ring-max mark-ring)) nil)
          (setcdr (nthcdr (1- mark-ring-max) mark-ring) nil)))
       ...
        (when (> (length global-mark-ring) global-mark-ring-max)
          (move-marker (car (nthcdr global-mark-ring-max global-mark-ring)) nil)
          (setcdr (nthcdr (1- global-mark-ring-max) global-mark-ring) nil)))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]