unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
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: Wed, 05 Jul 2017 23:25:10 -0700	[thread overview]
Message-ID: <m2eftudqux.wl%esq@lawlist.com> (raw)
In-Reply-To: <CAFM41H1VcYe=_nj3s1et+JKWNmgjkrsQN=XoT8KzCofHHToivw@mail.gmail.com>

Thank you for the helpful critique to substitute `window-buffer` for `get-window-buffer`.

I like to keep `debug-on-error` always set to `t`, and known situations I generally limit to showing me just a message in the echo area with the name of the function that generated it.  That's why I've been using the `quit` signal instead of popping open a `*Backrace*` buffer for familiar situations.

The code that the Emacs team implemented in response to bug#25599 is probably fine.  I just hadn't seen that before today, and my code predates its implementation.

Substituting the `warn` pop-up buffer for a plain old `message` was just a matter of personal preference.  Nothing substantive there was intended.

The existence and discussion surrounding `undo-tree.el` predates my usage of that library, but from what I can tell, at some point in the past `primitive-undo' was "improved" to start checking for errors and this resulted in bug #16377.  From an untrained layman's way of thinking, I am "guessing" that if undo-tree worked fine before `primitive-undo` was modified to throw an error, then perhaps it is not "a problem" with undo-tree except to the extent that undo-tree may need to "evolve" to play nice with the current version of `primitive-undo`.  Based on that "optional evolution theory", I created the workaround to just throw an informative message instead of an error.  However, I do not know if that approach could lead to problems.

I've spent quite a bit of time studying certain sections of the undo-tree.el library, but there are sections of the code that are still "Greek to me".  My understanding of the `undo-tree-canary` symbol inside the `buffer-undo-list` is that it is a way for undo-tree to check if it has interacted with the `buffer-undo-list`.  If the canary is not there, then handle the situation differently.  If the canary is there, then process the `buffer-undo-list` until reaching the canary.  It could be any arbitrary symbol so long as it remains at the tail end of the `buffer-undo-list` with a `nil` before it while undo-tree is being used in the buffer.  There is only one situation I am aware of where the `undo-tree-canary` disappears, and it happens sometimes with garbage collection (bug #27214).  Whate
 ver symbol is used, it needs to remain in the `buffer-undo-list` until `undo-tree-mode` is deactivated.  I suppose the design could have been different, but Dr. Cubitt probably had several additiona
 l reasons for using a constant symbol such as the `undo-tree-canary`.

Bug #16377 might very well be resolvable by tweaking/fixing undo-tree.el; however, the undo/redo in region code is still a few light years beyond my present abilities.

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> > +          (_
> > +            (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





  parent reply	other threads:[~2017-07-06  6:25 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
2017-07-06  6:25 ` Keith David Bershatsky [this message]
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=m2eftudqux.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=16377@debbugs.gnu.org \
    --cc=gundaetiapo@gmail.com \
    --cc=monnier@IRO.UMontreal.CA \
    --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).