unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: bug-gnu-emacs@gnu.org
Subject: Re: nesting of unwind-protect and atomic-change-group
Date: Mon, 04 Feb 2008 10:23:00 -0500	[thread overview]
Message-ID: <jwvlk60kaqs.fsf-monnier+gnu.emacs.bug@gnu.org> (raw)
In-Reply-To: <mailman.6883.1201974855.18990.bug-gnu-emacs@gnu.org> (Roland Winkler's message of "Sat, 2 Feb 2008 18:54:03 +0100")

>>>>> "Roland" == Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:

> On Sat Feb 2 2008 Richard Stallman wrote:
>> When combining unwind-protect and atomic-change-group I found that
>> putting unwind-protect outermost worked for me (i.e., an unwindform
>> moving point to the buffer location where the error occured was
>> obeyed), whereas doing it the other way round didn't work for me
>> (the unwindform was ignored). 
>> 
>> An unwind-protect will _work_ either inside or outside
>> of atomic-change-group.  Whatever problem you encountered
>> must be more specific.  I can't guess what it might be.

> Thanks for clarifying this. My real-world example based on
> bibtex-entry-format is too complicated as a test case. I'll boil it
> down to something more amenable.

The patch below should make both cases work similarly.


        Stefan


--- orig/lisp/subr.el
+++ mod/lisp/subr.el
@@ -2008,6 +2008,7 @@
 (defun cancel-change-group (handle)
   "Finish a change group made with `prepare-change-group' (which see).
 This finishes the change group by reverting all of its changes."
+  (save-excursion
   (dolist (elt handle)
     (with-current-buffer (car elt)
       (setq elt (cdr elt))
@@ -2029,7 +2030,7 @@
 	  (setcar elt old-car)
 	  (setcdr elt old-cdr))
 	;; Revert the undo info to what it was when we grabbed the state.
-	(setq buffer-undo-list elt)))))
+          (setq buffer-undo-list elt))))))
 \f
 ;;;; Display-related functions.
 




  parent reply	other threads:[~2008-02-04 15:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-01 16:48 nesting of unwind-protect and atomic-change-group Roland Winkler
2008-02-02  7:39 ` Richard Stallman
2008-02-02 17:54   ` Roland Winkler
2008-02-03 22:53   ` Roland Winkler
     [not found]   ` <mailman.6908.1202079211.18990.bug-gnu-emacs@gnu.org>
2008-02-04 15:21     ` Stefan Monnier
     [not found]   ` <mailman.6883.1201974855.18990.bug-gnu-emacs@gnu.org>
2008-02-04 15:23     ` Stefan Monnier [this message]
     [not found] <mailman.6846.1201884554.18990.bug-gnu-emacs@gnu.org>
2008-02-02  4:31 ` 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

  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=jwvlk60kaqs.fsf-monnier+gnu.emacs.bug@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=bug-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 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).