emacs-devel
[Top][All Lists]
Advanced

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

undo refactoring


From: Phillip Lord
Subject: undo refactoring
Date: Tue, 05 Jul 2016 09:46:46 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 (gnu/linux)


I thought to move this to emacs-devel rather than #23781 since it's not
directly relevant.


I'll think about the FIXME, that I've just added to undo.c, and see if I
can update that on master. But also, while reading the code again, I've
realised that I don't understand the reason for pre-allocating the
boundary, since when it actually used we do this:


      /* One way or another, cons nil onto the front of the undo list.  */
      if (!NILP (pending_boundary))
        {
          /* If we have preallocated the cons cell to use here,
             use that one.  */
          XSETCDR (pending_boundary, BVAR (current_buffer, undo_list));
          bset_undo_list (current_buffer, pending_boundary);
          pending_boundary = Qnil;
        }
      else
        bset_undo_list (current_buffer,
                        Fcons (Qnil, BVAR (current_buffer, undo_list)));


Why not just do

        bset_undo_list (current_buffer,
                        Fcons (Qnil, BVAR (current_buffer, undo_list)));

and remove all references to pending_boundary (and therefore
`prepare_record` which is now rather badly named)? Or am I missing
something

Phil



reply via email to

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