]> code.delx.au - gnu-emacs/blobdiff - lisp/autoinsert.el
Update PostScript version.
[gnu-emacs] / lisp / autoinsert.el
index ae6e986309782de4db03c78372a128ba5a3b71de..5ed3db56796ac84e0a0204e7c73ec32eb07fa24b 100644 (file)
@@ -103,13 +103,14 @@ If this contains a %s, that will be replaced by the matching rule."
     (("\\.\\([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)
-
-    ("[Mm]akefile\\'" . "makefile.inc")
+     (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") . "makefile.inc")
 
     (html-mode . (lambda () (sgml-tag "html")))