changeset 105858:e413a8093e28

(autoload-rubric): Add optional feature arg.
author Glenn Morris <rgm@gnu.org>
date Thu, 05 Nov 2009 03:22:55 +0000
parents 900207956538
children 658336850f93
files lisp/ChangeLog lisp/emacs-lisp/autoload.el
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Nov 05 03:22:18 2009 +0000
+++ b/lisp/ChangeLog	Thu Nov 05 03:22:55 2009 +0000
@@ -1,5 +1,7 @@
 2009-11-05  Glenn Morris  <rgm@gnu.org>
 
+	* emacs-lisp/autoload.el (autoload-rubric): Add optional feature arg.
+
 	* calendar/diary-lib.el (top-level): Make load behave more like require.
 
 2009-11-04  Dan Nicolaescu  <dann@ics.uci.edu>
--- a/lisp/emacs-lisp/autoload.el	Thu Nov 05 03:22:18 2009 +0000
+++ b/lisp/emacs-lisp/autoload.el	Thu Nov 05 03:22:55 2009 +0000
@@ -253,16 +253,25 @@
 	      (print-escape-nonascii t))
 	  (print form outbuf)))))))
 
-(defun autoload-rubric (file &optional type)
+(defun autoload-rubric (file &optional type feature)
   "Return a string giving the appropriate autoload rubric for FILE.
 TYPE (default \"autoloads\") is a string stating the type of
-information contained in FILE."
+information contained in FILE.  If FEATURE is non-nil, FILE
+will provide a feature.  FEATURE may be a string naming the
+feature, otherwise it will be based on FILE's name."
   (let ((basename (file-name-nondirectory file)))
     (concat ";;; " basename
 	    " --- automatically extracted " (or type "autoloads") "\n"
 	    ";;\n"
 	    ";;; Code:\n\n"
 	    "\n"
+	    ;; This is used outside of autoload.el.
+	    (if feature
+		(concat "(provide '"
+			(if (stringp feature) feature
+			  (file-name-sans-extension basename))
+			")\n")
+	      "")
 	    ";; Local Variables:\n"
 	    ";; version-control: never\n"
 	    ";; no-byte-compile: t\n"