X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/47e58cf5b9f71de4e99c170a185d5a57c1ed129d..3c53a3cf83c218772d9bcfde4cd60c1face33e93:/lisp/autoinsert.el diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el index 498808be5b..5ed3db5679 100644 --- a/lisp/autoinsert.el +++ b/lisp/autoinsert.el @@ -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) + (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"))) @@ -136,7 +137,7 @@ If this contains a %s, that will be replaced by the matching rule." "Short description: " ";;; " (file-name-nondirectory (buffer-file-name)) " --- " str " -;; Copyright (C) " (substring (current-time-string) -4) " " +;; Copyright (C) " (substring (current-time-string) -4) " " (getenv "ORGANIZATION") | "Free Software Foundation, Inc." " ;; Author: " (user-full-name) @@ -178,7 +179,10 @@ If this contains a %s, that will be replaced by the matching rule." -;;; " (file-name-nondirectory (buffer-file-name)) " ends here")) +\(provide '" + (file-name-sans-extension (file-name-nondirectory (buffer-file-name))) + ") +;;; " (file-name-nondirectory (buffer-file-name)) " ends here\n")) "A list specifying text to insert by default into a new file. Elements look like (CONDITION . ACTION) or ((CONDITION . DESCRIPTION) . ACTION). CONDITION maybe a regexp that must match the new file's name, or it may be