diff options
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/generate-lisp-file.el (renamed from lisp/emacs-lisp/generate-file.el) | 26 | ||||
-rw-r--r-- | lisp/emacs-lisp/loaddefs-gen.el | 17 |
2 files changed, 23 insertions, 20 deletions
diff --git a/lisp/emacs-lisp/generate-file.el b/lisp/emacs-lisp/generate-lisp-file.el index 456503df6a3..8896a3f7019 100644 --- a/lisp/emacs-lisp/generate-file.el +++ b/lisp/emacs-lisp/generate-lisp-file.el @@ -1,4 +1,4 @@ -;;; generate-file.el --- utility functions for generated files -*- lexical-binding: t -*- +;;; generate-lisp-file.el --- utility functions for generated files -*- lexical-binding: t -*- ;; Copyright (C) 2022 Free Software Foundation, Inc. @@ -26,17 +26,18 @@ (eval-when-compile (require 'cl-lib)) -(cl-defun generate-file-heading (file &key description text (code t)) - "Insert a standard header for FILE. +(cl-defun generate-lisp-file-heading (file generator + &key title commentary (code t)) + "Insert a standard header for FILE created by GENERATOR. This header will specify that this is a generated file that should not be edited. If `standard-output' is bound to a buffer, insert in that buffer. If no, insert at point in the current buffer. -DESCRIPTION (if any) will be used in the first line. +TITLE (if any) will be used in the first line. -TEXT (if given) will be inserted as a comment. +COMMENTARY (if given) will be inserted as a comment. If CODE is non-nil (which is the default), a Code: line is inserted." @@ -45,21 +46,22 @@ inserted." (current-buffer)) (insert ";;; " (file-name-nondirectory file) " --- " - (or description "automatically generated") + (or title "automatically generated") " (do not edit) " - " -*- lexical-binding: t -*-\n\n" + " -*- lexical-binding: t -*-\n" + (format ";; Generated by the `%s' function.\n\n" generator) ";; This file is part of GNU Emacs.\n\n") - (when text + (when commentary (insert ";;; Commentary:\n\n") (let ((start (point)) (fill-prefix ";; ")) - (insert ";; " text) + (insert ";; " commentary) (fill-region start (point)))) (ensure-empty-lines 1) (when code (insert ";;; Code:\n\n")))) -(cl-defun generate-file-trailer (file &key version inhibit-provide +(cl-defun generate-lisp-file-trailer (file &key version inhibit-provide (coding 'utf-8-emacs-unix) autoloads compile provide) "Insert a standard trailer for FILE. @@ -106,6 +108,6 @@ If no, insert at point in the current buffer." ";; End:\n\n" ";;; " (file-name-nondirectory file) " ends here\n"))) -(provide 'generate-file) +(provide 'generate-lisp-file) -;;; generate-file.el ends here +;;; generate-lisp-file.el ends here diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index 9aa2967d7b3..7661f60e0ba 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -40,7 +40,7 @@ (require 'radix-tree) (require 'lisp-mnt) -(require 'generate-file) +(require 'generate-lisp-file) (defvar autoload-compute-prefixes t "If non-nil, autoload will add code to register the prefixes used in a file. @@ -440,17 +440,18 @@ be a string naming the feature, otherwise it will be based on FILE's name." (let ((lp (and (equal type "package") (setq type "autoloads")))) (with-temp-buffer - (generate-file-heading - file - :description (concat "automatically extracted " (or type "autoloads")) - :text (and (string-match "/lisp/loaddefs\\.el\\'" file) - "This file will be copied to ldefs-boot.el and checked in periodically.")) + (generate-lisp-file-heading + file 'loaddefs-generate--rubric + :title (concat "automatically extracted " (or type "autoloads")) + :commentary (and (string-match "/lisp/loaddefs\\.el\\'" file) + "This file will be copied to ldefs-boot.el and checked in periodically.")) (when lp (insert "(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))\n\n")) (insert "\n;;; End of scraped data\n\n") - (generate-file-trailer file :provide (and (stringp feature) feature) - :inhibit-provide (not feature)) + (generate-lisp-file-trailer + file :provide (and (stringp feature) feature) + :inhibit-provide (not feature)) (buffer-string)))) (defun loaddefs-generate--insert-section-header (outbuf autoloads |