all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: A ton of marker entry in buffer-und-list
Date: Mon, 01 Mar 2021 13:13:22 -0500	[thread overview]
Message-ID: <jwv8s76pxjk.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: 8B9B7C97-A763-47EB-98BD-7A89B03E7182@gmail.com

>>> Hmmm, I just tried again and alas, I get the markers even without
>>> winner-mode. For some reason disabling winner-mode solved it when I
>>> last tested it. How strange.
>> 
>> Ok.
>> 
>> Now I used this:
>> 
>> #+begin_src emacs-lisp
>> (defun count-markers-in-buffer-undo-list ()
>>  "Message number of (different) markers in `buffer-undo-list'."
>>  (interactive)
>>  (require 'cl-lib)
>>  (message "%d" (length
>>                 (cl-delete-duplicates
>>                  (seq-filter #'markerp (flatten-tree (copy-tree buffer-undo-list)))
>>                  :test #'eq))))
>> #+end_src
>> 
>> to get the number of different markers in `buffer-undo-list', after
>> reproducing the recipe.  The answer was always "1".  Just a bunch of
>> entries referring to one and the same marker.  That seems sane.
>> 
>> Are you able to provide a more pathological recipe?
>> 
>
> Using the same recipe, I got 18, the number of marker entries in each undo
> step. Also, even if the answer is 1, it is not ok because that shortens the
> number of undo a buffer can record by a factor of n (e.g., 18 in my case).

IIUC this is the `window-point` marker being moved each time.  We could
try and avoid this by not recording it for the `window-point` of the
current `selected-window` (since its point is temporarily kept
elsewhere, really), but I'm not sure it's worth the trouble.

It's not as bad as it looks: this factor 18 is simply because those 18
insertions were collapsed into a single undo entry by
`undo-auto-amalgamate`, so it only applies when the only thing you do is
`self-insert-command`.  In "real life" the impact should be
significantly lower than that.

Of course, another way to reduce the problem is to improve the
amalgamation code so it not only amalgamate the entries for the actual
insertion but also the associated 18 entries that move that one marker.


        Stefan




  reply	other threads:[~2021-03-01 18:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26  4:32 A ton of marker entry in buffer-und-list Yuan Fu
2021-02-26  7:39 ` Eli Zaretskii
2021-02-26 13:20   ` Yuan Fu
2021-02-26 13:32     ` Eli Zaretskii
2021-02-26 17:48       ` Yuan Fu
2021-02-26 21:48         ` Michael Heerdegen
2021-02-27  7:08           ` Eli Zaretskii
2021-02-28  2:38             ` Michael Heerdegen
2021-02-28  4:20               ` Yuan Fu
2021-03-01  0:21                 ` Michael Heerdegen
2021-03-01 17:54                   ` Yuan Fu
2021-03-01 18:13                     ` Stefan Monnier [this message]
2021-03-01 23:25                     ` Michael Heerdegen
2021-03-02 20:29                       ` Yuan Fu
2021-03-03  3:40                         ` Michael Heerdegen
2021-03-03  3:53                           ` Michael Heerdegen
2021-03-03 16:04                             ` Yuan Fu
2021-03-03 22:52                               ` Michael Heerdegen
2021-02-26 15:49     ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=jwv8s76pxjk.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.