#7 Incompatibility with auto-insert-mode

open
nobody
None
5
2004-02-27
2004-02-27
Maciej Katafiasz
No

Activating ECB breaks auto-insert-mode rules for C
header files. Rule is:
(("\\.\\([Hh]\\|hh\\|hpp\\)\\'" . "C / C++ header")
(upcase
(concat
(file-name-nondirectory
(substring buffer-file-name 0
(match-beginning 0)))
"_"
(substring buffer-file-name
(1+
(match-beginning 0)))))
"#ifndef " str n "#define " str "\n\n" _ "\n\n#endif
/* " str " */")

And is supposed to insert:
#ifndef FOO_H
#define FOO_H

#endif /* FOO_H */

Activating ECB causes "FOO_H" to become
"/HOME/MYUSER/MYDIR/PROJECT/FOO.H". I've been able to
track it down to match-beginning, ie. when ECB is
activated it somehow alters its return value (probably
by calling it in the meantime), causing it to return
index of string end, which messes up output of the rule.

Discussion