Fix up comment convention on the arch-tag lines.
[bpt/emacs.git] / lisp / emacs-lisp / lisp-mnt.el
index aeb7fb2..f1df695 100644 (file)
@@ -1,6 +1,7 @@
 ;;; lisp-mnt.el --- utility functions for Emacs Lisp maintainers
 
-;; Copyright (C) 1992, 1994, 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1994, 1997, 2000, 2001, 2002, 2003, 2004,
+;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
 ;; Maintainer: FSF
@@ -12,7 +13,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -22,8 +23,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to
-;; the Free Software Foundation,  Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; the Free Software Foundation,  Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -36,7 +37,8 @@
 ;; Another entry point automatically addresses bug mail to a package's
 ;; maintainer or author.
 
-;; This file can be loaded by your lisp-mode-hook.  Have it (require 'lisp-mnt)
+;; This file can be loaded by your emacs-lisp-mode-hook.  Have it
+;; (require 'lisp-mnt)
 
 ;; This file is an example of the header conventions.  Note the following
 ;; features:
@@ -214,6 +216,7 @@ The end of the section is defined as the beginning of the next
 section of the same level or lower.  The function
 `lisp-outline-level' is used to compute the level of a section.
 If no such section exists, return the end of the buffer."
+  (require 'outline)   ;; for outline-regexp.
   (let ((start (lm-section-start header)))
     (when start
       (save-excursion
@@ -303,9 +306,14 @@ If FILE is nil, execute BODY in the current buffer."
        (if ,filesym
           (with-temp-buffer
             (insert-file-contents ,filesym)
+            (emacs-lisp-mode)
             ,@body)
-        (save-excursion 
-          ,@body)))))
+        (save-excursion
+          ;; Switching major modes is too drastic, so just switch
+          ;; temporarily to the Emacs Lisp mode syntax table.
+          (with-syntax-table emacs-lisp-mode-syntax-table
+            ,@body))))))
+
 (put 'lm-with-file 'lisp-indent-function 1)
 (put 'lm-with-file 'edebug-form-spec t)
 
@@ -412,7 +420,7 @@ ISO-DATE non-nil means return the date in ISO 8601 format."
            (format "%s-%s-%s" yyyy mm dd)
          (format "%s %s %s"
                  dd
-                 (nth (string-to-int mm)
+                 (nth (string-to-number mm)
                       '("" "Jan" "Feb" "Mar" "Apr" "May" "Jun"
                         "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"))
                  yyyy))))))
@@ -451,14 +459,14 @@ This can be found in an RCS or SCCS header."
     (if keywords
        (split-string keywords ",?[ \t]"))))
 
+(defvar finder-known-keywords)
 (defun lm-keywords-finder-p (&optional file)
   "Return non-nil if any keywords in FILE are known to finder."
   (require 'finder)
   (let ((keys (lm-keywords-list file)))
     (catch 'keyword-found
       (while keys
-       (if (assoc (intern (car keys)) 
-                  (with-no-warnings finder-known-keywords))
+       (if (assoc (intern (car keys)) finder-known-keywords)
            (throw 'keyword-found t))
        (setq keys (cdr keys)))
       nil)))
@@ -504,24 +512,23 @@ copyright notice is allowed."
     (if (and file (file-directory-p file))
        (setq ret
              (with-temp-buffer
-               (mapcar
-                (lambda (f)
-                  (if (string-match ".*\\.el\\'" f)
-                      (let ((status (lm-verify f)))
-                        (insert f ":")
-                        (if status
-                            (lm-insert-at-column lm-comment-column status
-                                                 "\n")
-                          (if showok
-                              (lm-insert-at-column lm-comment-column
-                                                   "OK\n"))))))
-                (directory-files file))))
+               (dolist (f (directory-files file nil "\\.el\\'")
+                          (buffer-string))
+                 (when (file-regular-p f)
+                   (let ((status (lm-verify f)))
+                     (insert f ":")
+                     (if status
+                         (lm-insert-at-column lm-comment-column status
+                                              "\n")
+                       (if showok
+                           (lm-insert-at-column lm-comment-column
+                                                "OK\n"))))))))
       (lm-with-file file
        (setq name (lm-get-package-name))
        (setq ret
              (cond
               ((null name)
-               (format "Package %s does not exist"))
+               "Can't find package name")
               ((not (lm-authors))
                "`Author:' tag missing")
               ((not (lm-maintainer))
@@ -545,7 +552,7 @@ copyright notice is allowed."
                    (concat "^;;;[ \t]+" name "[ \t]+ends here[ \t]*$"
                            "\\|^;;;[ \t]+ End of file[ \t]+" name)
                    nil t)))
-               (format "Can't find the footer line"))
+               "Can't find the footer line")
               ((not (and (lm-copyright-mark) (lm-crack-copyright)))
                "Can't find a valid copyright notice")
               ((not (or non-fsf-ok
@@ -555,7 +562,7 @@ copyright notice is allowed."
               (t
                ret)))))
     (if verbose
-       (message ret))
+       (message "%s" ret))
     ret))
 
 (defun lm-synopsis (&optional file showall)
@@ -603,10 +610,10 @@ Prompts for bug subject TOPIC.  Leaves you in a mail buffer."
     (if version
        (insert " version " version))
     (newline 2)
-    (message
+    (message "%s"
      (substitute-command-keys "Type \\[mail-send] to send bug report."))))
 
 (provide 'lisp-mnt)
 
-;;; arch-tag: fa3c5ab4-a37b-4e46-b7cf-b6d78b90e69e
+;; arch-tag: fa3c5ab4-a37b-4e46-b7cf-b6d78b90e69e
 ;;; lisp-mnt.el ends here