changeset 42161:18516f8e5cff

(auto-insert-alist): Redo finding C and C++ headers. Add a DESCRIPTION for the makefile item.
author Richard M. Stallman <rms@gnu.org>
date Tue, 18 Dec 2001 19:37:37 +0000
parents 530136f9f1b9
children 478d5ff60075
files lisp/autoinsert.el
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/autoinsert.el	Tue Dec 18 19:36:46 2001 +0000
+++ b/lisp/autoinsert.el	Tue Dec 18 19:37:37 2001 +0000
@@ -103,13 +103,14 @@
     (("\\.\\([Cc]\\|cc\\|cpp\\)\\'" . "C / C++ program")
      nil
      "#include \""
-     ;; nop without latest cc-mode
-     (and (fboundp 'c-companion-file)
-	  ;(file-readable-p (c-companion-file 'name))
-	  (file-name-nondirectory (c-companion-file 'name))) & ?\"
-     | -10)
+     (let ((stem (file-name-sans-extension buffer-file-name)))
+       (cond ((file-exists-p (concat stem ".h"))
+	      (file-name-nondirectory (concat stem ".h")))
+	     ((file-exists-p (concat stem ".hh"))
+	      (file-name-nondirectory (concat stem ".hh")))))
+     & ?\" | -10)
 
-    ("[Mm]akefile\\'" . "makefile.inc")
+    (("[Mm]akefile\\'" . "Makefile") . "makefile.inc")
 
     (html-mode . (lambda () (sgml-tag "html")))