]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/lisp-mnt.el
(xscheme-control-g-synchronization-p): Doc fix.
[gnu-emacs] / lisp / emacs-lisp / lisp-mnt.el
index 55de8f26de2b456c49ec6868254e8c2855084d3f..986f61754cf01e21e2bfa082fa50c3a873ac6c4f 100644 (file)
@@ -1,19 +1,19 @@
 ;;; lisp-mnt.el --- minor mode for Emacs Lisp maintainers
 
-;; Copyright (C) 1992 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
 
 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
 ;; Maintainer: Eric S. Raymond <esr@snark.thyrsus.com>
 ;; Created: 14 Jul 1992
-;; Version: $Id: lisp-mnt.el,v 1.3 1993/03/24 23:46:52 esr Exp $
+;; Version: $Id: lisp-mnt.el,v 1.10 1995/03/16 04:37:48 rms Exp kwzh $
 ;; Keywords: docs
-;; Bogus-Bureaucratic-Cruft: Gruad will get you if you don't watch out!
+;; X-Bogus-Bureaucratic-Cruft: Gruad will get you if you don't watch out!
 
 ;; This file is part of GNU Emacs.
 
 ;; 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 1, or (at your option)
+;; the Free Software Foundation; either version 2, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; author *is* one of the maintainers.)
 ;; 
 ;;    * Keywords line --- used by the finder code (now under construction)
-;; for finding elisp code related to a topic.
+;; for finding Emacs Lisp code related to a topic.
 ;;
-;;    * Bogus-Bureaucratic-Cruft line --- this is a joke.  I figured I should
-;; satirize this design before someone else did.  Also, it illustrates the
-;; possibility that other headers may be added in the future for new purposes.
+;;    * X-Bogus-Bureaucratic-Cruft line --- this is a joke and an example
+;; of a comment header.  Headers starting with `X-' should never be used
+;; for any real purpose; this is the way to safely add random headers
+;; without invoking the wrath of any program.
 ;;
 ;;    * Commentary line --- enables lisp code to find the developer's and
 ;; maintainers' explanations of the package internals.
 ;;    * Change log line --- optional, exists to terminate the commentary
 ;; section and start a change-log part, if one exists.
 ;; 
-;;    * Code line --- exists so elisp can know where commentary and/or
+;;    * Code line --- exists so Lisp can know where commentary and/or
 ;; change-log sections end.
 ;; 
 ;;    * Footer line --- marks end-of-file so it can be distinguished from
 
 ;; These functions all parse the headers of the current buffer
 
-(defun lm-section-mark (hd)
+(defun lm-section-mark (hd &optional after)
   ;; Return the buffer location of a given section start marker
   (save-excursion
     (let ((case-fold-search t))
       (goto-char (point-min))
-      (if (re-search-forward (concat "^;;; " hd ":$") nil t)
+      (if (re-search-forward (concat "^;;;;* " hd ":[ \t]*$") nil t)
          (progn
            (beginning-of-line)
+           (if after (forward-line 1))
            (point))
        nil))))
 
          (kill-buffer (current-buffer)))
       )))
 
-(defun lm-commentary-region (&optional file)
-  ;; Return a pair of character locations enclosing the commentary region.
+(defun lm-commentary (&optional file)
+  ;; Return the commentary region of a file, as a string.
   (save-excursion
     (if file
        (find-file file))
     (prog1
-       (let ((commentary (lm-section-mark "Commentary"))
+       (let ((commentary (lm-section-mark "Commentary" t))
              (change-log (lm-section-mark "Change Log"))
              (code (lm-section-mark "Code")))
-         (if commentary
+         (and commentary
              (if change-log
-                 (cons commentary change-log)
-               (cons commentary code)))
+                 (buffer-substring commentary change-log)
+               (buffer-substring commentary code)))
          )
       (if file
          (kill-buffer (current-buffer)))
@@ -419,11 +421,15 @@ Prompts for bug subject.  Leaves you in a mail buffer."
   (let ((package (buffer-name))
        (addr (lm-maintainer))
        (version (lm-version)))
-    (mail nil (or addr bug-gnu-emacs) topic)
+    (mail nil
+         (if addr
+             (concat (car addr) " <" (cdr addr) ">")
+           bug-gnu-emacs)
+         topic)
     (goto-char (point-max))
     (insert "\nIn "
            package
-           (and version (concat " version " version))
+           (if version (concat " version " version) "")
            "\n\n")
     (message
      (substitute-command-keys "Type \\[mail-send] to send bug report."))))