[Top][All Lists]

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

disabling undo boundaries

From: Phillip Lord
Subject: disabling undo boundaries
Date: Sun, 10 May 2015 22:43:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

I am a little confused by undo boundaries and how and when they get set.

Consider this, entirely pointless piece of code.

  (defvar fix-test-on nil)
  (defun fix-test-after-change-function (&rest _)
    (when fix-test-on
          (get-buffer "*scratch*")
        (insert "a"))))

  (add-hook 'after-change-functions 'fix-test-after-change-function)

Now, If I delete buffer-undo-list in the current buffer (not *scratch*)
then type "abc", I get a buffer-undo-list something like...

(nil (355 . 358))

Now if I set fix-test-on to t and do the same, I get this.

(nil (357 . 358) nil (356 . 357) nil (355 . 356))

I am wondering why the "nil" undo-boundaries get inserted when I change
*a different* buffer. This does not really make sense to me, and is
causing breakage in my package.

I can't for the life of me find out where this nil boundary is getting
added; it appears to happen *after* the after-change-function ends, as I
find by logging buffer-undo-list in my a-c-f, so it's neither the
buffer-change nor the insert itself. Unfortunately, this also means I
cannot fix the problem in the a-c-f.

Any other ideas welcome!


reply via email to

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