unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Cc: Lars Ingebrigtsen <larsi@gnus.org>
Subject: Re: master 9d2f4a8d5a: Add convenience functions for generating Emacs Lisp files
Date: Sun, 05 Jun 2022 11:11:21 -0400	[thread overview]
Message-ID: <jwva6arrwa0.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20220605143641.51EE9C009A8@vcs2.savannah.gnu.org> (Lars Ingebrigtsen's message of "Sun,  5 Jun 2022 10:36:40 -0400 (EDT)")

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	other threads:[~2022-06-05 15:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <165443980067.10742.1255334855562523988@vcs2.savannah.gnu.org>
     [not found] ` <20220605143641.51EE9C009A8@vcs2.savannah.gnu.org>
2022-06-05 15:11   ` Stefan Monnier [this message]
2022-06-05 15:40     ` master 9d2f4a8d5a: Add convenience functions for generating Emacs Lisp files Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwva6arrwa0.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).