From a461758e7314906e2a3c2404f825a3334c0993f7 Mon Sep 17 00:00:00 2001 From: Dave Love Date: Mon, 25 Sep 2000 14:43:35 +0000 Subject: [PATCH] (auto-insert): Doc fix. (auto-insert-alist): Following GNU notices, don't say `copyright _by_'. Use line-beginning-position. (auto-insert): Check buffer-file-name is non-nil before use. --- lisp/ChangeLog | 7 +++++++ lisp/autoinsert.el | 13 +++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 52919a0aa6a..2a348be896a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2000-09-25 Dave Love + + * autoinsert.el (auto-insert): Doc fix. + (auto-insert-alist): Following GNU notices, don't say `copyright + _by_'. Use line-beginning-position. + (auto-insert): Check buffer-file-name is non-nil before use. + 2000-09-25 Gerd Moellmann * textmodes/texinfo.el (texinfo-mode): Prevent filling lines diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el index 9f3f9da1b0b..59430cafdd4 100644 --- a/lisp/autoinsert.el +++ b/lisp/autoinsert.el @@ -1,6 +1,6 @@ ;;; autoinsert.el --- automatic mode-dependent insertion of text into new files -;; Copyright (C) 1985, 86, 87, 94, 95, 98 Free Software Foundation, Inc. +;; Copyright (C) 1985, 86, 87, 94, 95, 98, 2000 Free Software Foundation, Inc. ;; Author: Charlie Martin ;; Adapted-By: Daniel Pfeiffer @@ -77,7 +77,7 @@ Possible values: Insertion is possible when something appropriate is found in `auto-insert-alist'. When the insertion is marked as unmodified, you can save it with \\[write-file] RET. -This variable is used when `auto-insert' is called as a function, e.g. +This variable is used when the function `auto-insert' is called, e.g. when you do (add-hook 'find-file-hooks 'auto-insert). With \\[auto-insert], this is always treated as if it were t." :type '(choice (const :tag "Insert if possible" t) @@ -147,11 +147,11 @@ 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) " by " +;; Copyright (C) " (substring (current-time-string) -4) " " (getenv "ORGANIZATION") | "Free Software Foundation, Inc." " ;; Author: " (user-full-name) -'(if (search-backward "&" (save-excursion (beginning-of-line 1) (point)) t) +'(if (search-backward "&" (line-beginning-position) t) (replace-match (capitalize (user-login-name)) t t)) '(end-of-line 1) " <" (progn user-mail-address) "> ;; Keywords: " @@ -213,7 +213,7 @@ described above, e.g. [\"header.insert\" date-and-author-update]." ;;;###autoload (defun auto-insert () - "Insert default contents into a new file if `auto-insert' is non-nil. + "Insert default contents into new files if variable `auto-insert' is non-nil. Matches the visited file name against the elements of `auto-insert-alist'." (interactive) (and (not buffer-read-only) @@ -231,7 +231,8 @@ Matches the visited file name against the elements of `auto-insert-alist'." cond (car cond))) (if (if (symbolp cond) (eq cond major-mode) - (string-match cond buffer-file-name)) + (and buffer-file-name + (string-match cond buffer-file-name))) (setq action (cdr (car alist)) alist nil) (setq alist (cdr alist)))) -- 2.39.2