unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Keith David Bershatsky <esq@lawlist.com>
Cc: 16377@debbugs.gnu.org, Barry OReilly <gundaetiapo@gmail.com>,
	Toby Cubitt <toby-undo-tree@dr-qubit.org>
Subject: bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary")
Date: Thu, 06 Jul 2017 01:35:54 -0400	[thread overview]
Message-ID: <jwvk23muop9.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <m2fueaduqr.wl%esq@lawlist.com> (Keith David Bershatsky's message of "Wed, 05 Jul 2017 22:01:16 -0700")

> +        (window-of-current-buffer (get-buffer-window (current-buffer)))
> +        (selected-window (selected-window)))
[...]
> +              (unless (eq window-of-current-buffer selected-window)

Better check (eq (window-buffer) (current-buffer)), since these two
functions are mere accessors, whereas get-buffer-window is a funny
function which returns *one of* the buffer's windows (or nil) and is
hence both more costly (it has a loop inside) and less reliable.

> -           (when (or (> (point-min) beg) (< (point-max) end))
> -             (error "Changes to be undone are outside visible portion of buffer"))
> +            (when (or (> (point-min) beg) (< (point-max) end))
> +              (let ((debug-on-quit nil)
> +                    (msg (concat
> +                           "undo-tree--primitive-undo (1 of 4):"
> +                           "  "
> +                           "Changes to be undone are outside visible portion of buffer.")))
> +                (signal 'quit `(,msg))))

Not sure what is the benefit of signaling `quit` rather than `error`.
Can you expand on that?

> -               ;; Insert might have invalidated some of the markers
> -               ;; via modification hooks.  Update only the currently
> -               ;; valid ones (bug#25599).
> -               (if (marker-buffer (car adj))
> -                   (set-marker (car adj)
> -                               (- (car adj) (cdr adj)))))))
> +               (set-marker (car adj)
> +                           (- (car adj) (cdr adj))))))

IIUC, this is an unintended change in your code, right?

>            ;; (MARKER . OFFSET) means a marker MARKER was adjusted by OFFSET.
>            (`(,(and marker (pred markerp)) . ,(and offset (pred integerp)))
> -           (warn "Encountered %S entry in undo list with no matching (TEXT . POS) entry"
> -                 next)
> +            (let ((msg
> +                    (concat
> +                      "undo-tree--primitive-undo:  "
> +                      (format "Encountered %S entry in undo list with no matching (TEXT . POS) entry"
> +                              next))))
> +              (message msg))

What is this change meant to do?

> +          (_
> +            (if (eq next 'undo-tree-canary)
> +              (message "undo-tree--primitive-undo:  catch-all found `%s'." next)
> +              (error "Unrecognized entry in undo list %S" next)))))

This might make sense to work around the problem, but is clearly not an
actual fix.  IIUC Tony said it looked like a bug in undo-tree.
Has there been any progress on finding/fixing the bug there?
What is this "canary" meant to do?  If it shouldn't signal an error
here, maybe rather than the constant `undo-tree-canary`, undo-tree
should use another constant value, i.e. one that is a valid (and
harmless) undo entry.


        Stefan





  reply	other threads:[~2017-07-06  5:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07  0:32 bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") Barry OReilly
2014-01-07  4:14 ` Toby Cubitt
2014-01-22  3:23   ` Barry OReilly
2014-01-22 17:08     ` bug#16523: " Toby Cubitt
2014-01-08  3:37 ` bug#16377: " Toby Cubitt
2014-01-22  0:05   ` Barry OReilly
     [not found]     ` <20140122141701.GA6728@c3po>
2014-01-22 15:26       ` Barry OReilly
2014-01-22 17:05         ` Toby Cubitt
2014-01-22 18:56           ` Stefan Monnier
2014-01-22 21:30             ` Toby Cubitt
2017-07-06  0:33 ` Keith David Bershatsky
2017-07-06  5:01 ` Keith David Bershatsky
2017-07-06  5:35   ` Stefan Monnier [this message]
2017-07-06  6:25 ` Keith David Bershatsky
2017-07-06  9:02   ` Toby Cubitt
2017-07-06  9:47     ` Toby Cubitt

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvk23muop9.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=16377@debbugs.gnu.org \
    --cc=esq@lawlist.com \
    --cc=gundaetiapo@gmail.com \
    --cc=toby-undo-tree@dr-qubit.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).