emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 9d2f4a8d5a: Add convenience functions for generating Emacs Li


From: Stefan Monnier
Subject: Re: master 9d2f4a8d5a: Add convenience functions for generating Emacs Lisp files
Date: Sun, 05 Jun 2022 11:11:21 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Thank you, Lars.  I can't believe it didn't occur to me earlier.

> +++ b/lisp/emacs-lisp/generate-file.el

I'd put "elisp" or somesuch in the name, to make it clear it's about
generation of ELisp files rather than generation of any other kinds
of files.

> +(cl-defun generate-file-heading (file &key description text (code t))
> +  "Insert a standard header for FILE.
> +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.
> +TEXT (if given) will be inserted as a comment.

I suggest to use names that make it more clear which of the two should
be a single line.  Maybe `title` and `commentary`?

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

Why would we ever want to not insert `Code:`?

More importantly, I think this function needs an additional (and
mandatory!) argument, which specifies which function generated it.
I've too often wasted time locating the code responsible for a bug in
the generated file just because that file failed to tell me where this
generated file comes from, so we should make it "harder" to generate
a file without that origin information.

> +            ";; This file is part of GNU Emacs.\n\n")

Hmm... this makes the function unusable for third party packages,
doesn't it?


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]