[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
auto-insert uses outdated match data.
From: |
Lute Kamstra |
Subject: |
auto-insert uses outdated match data. |
Date: |
Thu, 13 Nov 2008 06:43:40 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
I can't seem to reproduce it now, but a few months ago I saw a few cases
where the auto insertion of C / C++ headers failed because it uses the
match data of the re-search on the buffer name. Apparently there was
another re-search in between the match on the buffer name and the use of
the match data by auto insert to insert contents into the newly created
buffer. The following patch fixed the problem for me. OK to commit?
Lute.
Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.14762
diff -c -r1.14762 ChangeLog
*** lisp/ChangeLog 13 Nov 2008 05:03:33 -0000 1.14762
--- lisp/ChangeLog 13 Nov 2008 05:32:15 -0000
***************
*** 1,3 ****
--- 1,7 ----
+ 2008-11-13 Lute Kamstra <address@hidden>
+
+ * autoinsert.el (auto-insert-alist): Don't use match data.
+
2008-11-13 Glenn Morris <address@hidden>
* nxml/nxml-enc.el: Remove some charset code not needed since Emacs 22.
Index: lisp/autoinsert.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/autoinsert.el,v
retrieving revision 1.58
diff -c -r1.58 autoinsert.el
*** lisp/autoinsert.el 29 May 2008 09:40:06 -0000 1.58
--- lisp/autoinsert.el 13 Nov 2008 05:32:15 -0000
***************
*** 93,101 ****
(defcustom auto-insert-alist
'((("\\.\\([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")
--- 93,101 ----
(defcustom auto-insert-alist
'((("\\.\\([Hh]\\|hh\\|hpp\\)\\'" . "C / C++ header")
(upcase (concat (file-name-nondirectory
! (file-name-sans-extension buffer-file-name))
"_"
! (file-name-extension buffer-file-name)))
"#ifndef " str \n
"#define " str "\n\n"
_ "\n\n#endif")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- auto-insert uses outdated match data.,
Lute Kamstra <=