emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] fix/no-undo-boundary-on-secondary-buffer-change f59d1b


From: Stefan Monnier
Subject: Re: [Emacs-diffs] fix/no-undo-boundary-on-secondary-buffer-change f59d1be: Move undo amalgamation to lisp.
Date: Mon, 05 Oct 2015 11:15:34 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> +(defun undo-auto-pre-command-hook()
> +  (when (and (eq last-command 'self-insert-command)
> +             (eq this-command 'self-insert-command))

I think this code should be called from self-insert-command rather than
from pre-command-hook.  And it should also be called from delete-char.

> +    ;; As last-command was s-i-c, there should be "insert" cons just
> +    ;; before this. We need to check that there have not been too many 
> insertions
> +    (let ((last-before-nil
> +           (cadr buffer-undo-list)))
> +      (when
> +          (> 20
> +             (- (cdr last-before-nil)
> +                (car last-before-nil)))

We don't actually know that (cdr last-before-nil) and (car
last-before-nil) are numbers.  The previous self-insert-command might
have performed all kinds of buffer modifications (via abbrev-expansion,
post-self-insert-hook, ...).


        Stefan



reply via email to

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