Convert consecutive FSF copyright years to ranges.
[bpt/emacs.git] / lisp / emacs-lisp / lisp-mnt.el
index f1df695..4d0cacf 100644 (file)
@@ -1,7 +1,6 @@
 ;;; lisp-mnt.el --- utility functions for Emacs Lisp maintainers
 
-;; Copyright (C) 1992, 1994, 1997, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1994, 1997, 2000-2011 Free Software Foundation, Inc.
 
 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
 ;; Maintainer: FSF
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; 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 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,9 +21,7 @@
 ;; GNU General Public License for more details.
 
 ;; 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., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -77,8 +74,7 @@
 ;;
 ;;    * Maintainer line --- should be a single name/address as in the Author
 ;; line, or an address only, or the string "FSF".  If there is no maintainer
-;; line, the person(s) in the Author field are presumed to be it.  The example
-;; in this file is mildly bogus because the maintainer line is redundant.
+;; line, the person(s) in the Author field are presumed to be it.
 ;;    The idea behind these two fields is to be able to write a Lisp function
 ;; that does "send mail to the author" without having to mine the name out by
 ;; hand.  Please be careful about surrounding the network address with <> if
@@ -96,8 +92,8 @@
 ;; package for the distribution.  (This file doesn't have one because the
 ;; author *is* one of the maintainers.)
 ;;
-;;    * Keywords line --- used by the finder code (now under construction)
-;; for finding Emacs Lisp code related to a topic.
+;;    * Keywords line --- used by the finder code for finding Emacs
+;; Lisp code related to a topic.
 ;;
 ;;    * X-Bogus-Bureaucratic-Cruft line --- this is a joke and an example
 ;; of a comment header.  Headers starting with `X-' should never be used
@@ -301,6 +297,7 @@ The returned value is a list of strings, one per line."
 (defmacro lm-with-file (file &rest body)
   "Execute BODY in a buffer containing the contents of FILE.
 If FILE is nil, execute BODY in the current buffer."
+  (declare (indent 1) (debug t))
   (let ((filesym (make-symbol "file")))
     `(let ((,filesym ,file))
        (if ,filesym
@@ -314,9 +311,6 @@ If FILE is nil, execute BODY in the current buffer."
           (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)
-
 ;; Fixme: Probably this should be amalgamated with copyright.el; also
 ;; we need a check for ranges in copyright years.
 
@@ -448,16 +442,22 @@ This can be found in an RCS or SCCS header."
            (match-string-no-properties 1)))))))
 
 (defun lm-keywords (&optional file)
-  "Return the keywords given in file FILE, or current buffer if FILE is nil."
+  "Return the keywords given in file FILE, or current buffer if FILE is nil.
+The return is a `downcase'-ed string, or nil if no keywords
+header.  Multi-line keywords are joined up with a space between
+each line."
   (lm-with-file file
-    (let ((keywords (lm-header "keywords")))
-      (and keywords (downcase keywords)))))
+    (let ((keywords (lm-header-multiline "keywords")))
+      (and keywords
+          (mapconcat 'downcase keywords " ")))))
 
 (defun lm-keywords-list (&optional file)
   "Return list of keywords given in file FILE."
   (let ((keywords (lm-keywords file)))
     (if keywords
-       (split-string keywords ",?[ \t]"))))
+       (if (string-match-p "," keywords)
+           (split-string keywords ",[ \t\n]*" t)
+         (split-string keywords "[ \t\n]+" t)))))
 
 (defvar finder-known-keywords)
 (defun lm-keywords-finder-p (&optional file)
@@ -586,12 +586,12 @@ which do not include a recognizable synopsis."
       (let ((must-kill (and file (not (get-file-buffer file)))))
         (when file (find-file file))
         (prog1
-            (if (interactive-p)
+            (if (called-interactively-p 'interactive)
                 (message "%s" (lm-summary))
               (lm-summary))
           (when must-kill (kill-buffer (current-buffer))))))))
 
-(eval-when-compile (defvar report-emacs-bug-address))
+(defvar report-emacs-bug-address)
 
 (defun lm-report-bug (topic)
   "Report a bug in the package currently being visited to its maintainer.
@@ -615,5 +615,4 @@ Prompts for bug subject TOPIC.  Leaves you in a mail buffer."
 
 (provide 'lisp-mnt)
 
-;; arch-tag: fa3c5ab4-a37b-4e46-b7cf-b6d78b90e69e
 ;;; lisp-mnt.el ends here