bug-gnu-emacs
[Top][All Lists]
Advanced

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

Special case broken in vc-backend-dispatch macro in vc.el


From: era eriksson
Subject: Special case broken in vc-backend-dispatch macro in vc.el
Date: Sun, 22 Apr 2001 16:34:44 +0300

This bug report will be sent to the Free Software Foundation,
 not to your local site managers!!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

In GNU Emacs 20.3.2 (i386-debian-linux-gnu, X toolkit)
 of Thu Jan 28 1999 on raven
configured using `configure  i386-debian-linux-gnu --prefix=/usr 
--sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib 
--infodir=/usr/info --with-pop=yes --with-x=yes --with-x-toolkit=yes'

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

The function `vc-insert-headers' when invoked on a CVS-controlled file
prompts for confirmation when attempting to insert headers into a
file, stating that headers are already present even when this is
clearly not the case, such as in a completely empty file.

This seems to trace back to the macro `vc-backend-dispatch', which is
supposed to have a special case for the final argument; if the fourth
argument to the macro is 'RCS then the action for CVS should be the
action specified for RCS. However, I cannot get this to work as
specified; indeed, you can verify this yourself by evaluating the
following form in a CVS-controlled file:

    (vc-backend-dispatch buffer-file-name "one" "two" 'RCS)

This ought to return "two" but when I try it, I get 'RCS instead.
(In this *mail* buffer, of course, I get nil, because it's not under
version contol at all.)

As far as I can tell, this happens because the definition of the macro
`vc-backend-dispatch' is not adequately quoted. By using the the
following macro definition instead, I get the documented behavior:

(defmacro vc-backend-dispatch (f s r c)
  "Execute FORM1, FORM2 or FORM3 for SCCS, RCS or CVS respectively.
If FORM3 is `RCS', use FORM2 for CVS as well as RCS.
\(CVS shares some code with RCS)."
  (list 'let (list (list 'type (list 'vc-backend f)))
        (list 'cond
              (list (list 'eq 'type (quote 'SCCS)) s)   ;; SCCS
              (list (list 'eq 'type (quote 'RCS)) r)    ;; RCS
              (list (list 'eq 'type (quote 'CVS))       ;; CVS
                    ;; (if (eq c 'RCS) r c)) ;; Quoting bug! Replacement here:
                    (list 'if (list 'eq c (quote 'RCS)) r c))
              )))

Of course, some heretic might have the nerve to suggest using the
backquote facility, and/or documenting all the arguments consistently
(the f argument is the name of the file we are going to operate on).

For what it's worth, I found this special case of the macro used
exactly once in vc.el and not at all in vc-hook.el. (This is in the
function `vc-check-headers', which in turn appears to be used only by
the function `vc-insert-headers'.)

Sorry if this has been reported by someone else already -- I'm afraid
I don't have the resources to monitor the bleeding edge of Emacs
development.

/* era */


Recent input:
return escape : ( v c - b a c k e n d - d i s p a t 
c h SPC b u f f e r - f i l e - n a m e SPC \304 backspace 
' " backspace backspace " o n e " SPC " t o e backspace 
backspace w o " SPC \344 backspace ' R C S ) return 
escape : escape p return C-x v h n escape : escape 
p return C-x 1 escape x r e p o r t - e m tab return

Recent messages:
Please type y, n or r; or ? for help
Quit
Symbol's function definition is void: vc-backend-dispatch [2 times]
Loading vc...
Loading derived...
Loading derived...done
Loading vc...done
RCS
Loading emacsbug...
Loading emacsbug...done

-- 
 Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
  Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition



reply via email to

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