]> git.eshelyaron.com Git - emacs.git/commitdiff
(auto-insert-alist): Redo finding C and C++ headers.
authorRichard M. Stallman <rms@gnu.org>
Fri, 2 Aug 2002 17:56:49 +0000 (17:56 +0000)
committerRichard M. Stallman <rms@gnu.org>
Fri, 2 Aug 2002 17:56:49 +0000 (17:56 +0000)
lisp/autoinsert.el

index ae6e986309782de4db03c78372a128ba5a3b71de..7583512dcfd8ddc9af162966e0afe8d8d57e1f31 100644 (file)
@@ -103,11 +103,12 @@ 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)
+     (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")