Function: generate-lisp-file-heading

generate-lisp-file-heading is a byte-compiled function defined in generate-lisp-file.el.gz.

Signature

(generate-lisp-file-heading FILE GENERATOR &key TITLE COMMENTARY (CODE t))

Documentation

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.

TITLE (if any) will be used in the first line.

COMMENTARY (if given) will be inserted as a comment.

If CODE is non-nil (which is the default), a Code: line is inserted.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/generate-lisp-file.el.gz
(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.

TITLE (if any) will be used in the first line.

COMMENTARY (if given) will be inserted as a comment.

If CODE is non-nil (which is the default), a Code: line is
inserted."
  (with-current-buffer (if (bufferp standard-output)
                           standard-output
                         (current-buffer))
    (insert ";;; " (file-name-nondirectory file)
            " --- "
            (or title "automatically generated")
            " (do not edit) "
            "  -*- lexical-binding: t -*-\n"
            (format ";; Generated by the `%s' function.\n\n" generator)
            ";; This file is part of GNU Emacs.\n\n")
    (when commentary
      (insert ";;; Commentary:\n\n")
      (let ((start (point))
            (fill-prefix ";; "))
        (insert ";; " commentary)
        (fill-region start (point))))
    (ensure-empty-lines 1)
    (when code
      (insert ";;; Code:\n\n"))))