Subject: Re: bug#20149: Cannot byte-compile 'undo-tree' since commit 801eda8a2

From: Tassilo Horn <[email-masked]>
Date: Fri, 20 Mar 2015 09:56:38 +0100

Vladimir Lomov <[email-masked]> writes:

>   In undo-tree-update-menu-bar:
>   undo-tree.el:1232:7:Warning: reference to free variable `undo-tree-mode'
>   undo-tree.el:1481:1:Error: Symbol's function definition is void: undo-tree-make-node
>
> I tracked down to the commit when Emacs was able to compile the
> 'undo-tree' package, this is commit f925fc93 but starting from next
> commit, 801eda8a2, the package isn't byte-compiled. Actually, I wasn't
> able to compile Emacs taking source from commit 801eda8a2 and next three
> ones. 
>
>> Could you please verify that compiling undo-tree works again with the
>> current emacs git version?  If so, feel free to close this bug by
>> replying to [email-masked].
>
> I did fresh Emacs build (commit 395a76a) and I see the same message when
> byte-compile 'undo-tree' package.

Ok, I see, and I confirm the compile error.  `undo-tree-make-node' is an
undo-tree-node constructor.  So it seems to be another problem with
Stefan's latest cl-defstruct changes.  I've added him to Cc.

undo-tree is here: http://www.dr-qubit.org/git/undo-tree.git

The definition of the constructor is this:

--8<---------------cut here---------------start------------->8---
(defstruct
  (undo-tree-node
   (:type vector)   ; create unnamed struct
   (:constructor nil)
   (:constructor undo-tree-make-node
                 (previous undo
		  &optional redo
                  &aux
                  (timestamp (current-time))
                  (branch 0)))
   (:constructor undo-tree-make-node-backwards
                 (next-node undo
		  &optional redo
                  &aux
                  (next (list next-node))
                  (timestamp (current-time))
                  (branch 0)))
   (:copier nil))
  previous next undo redo timestamp branch meta-data)
--8<---------------cut here---------------end--------------->8---

The error location (which looks strange to me) is this:

--8<---------------cut here---------------start------------->8---
(defun undo-tree-register-data-p (data)  ;; <== HERE
  (and (vectorp data)
       (= (length data) 2)
       (undo-tree-node-p (undo-tree-register-data-node data))))
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo