* Re: master 9d2f4a8d5a: Add convenience functions for generating Emacs Lisp files
[not found] ` <20220605143641.51EE9C009A8@vcs2.savannah.gnu.org>
@ 2022-06-05 15:11 ` Stefan Monnier
2022-06-05 15:40 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2022-06-05 15:11 UTC (permalink / raw)
To: emacs-devel; +Cc: Lars Ingebrigtsen
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: master 9d2f4a8d5a: Add convenience functions for generating Emacs Lisp files
2022-06-05 15:11 ` master 9d2f4a8d5a: Add convenience functions for generating Emacs Lisp files Stefan Monnier
@ 2022-06-05 15:40 ` Lars Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-05 15:40 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> +++ 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.
I'd hoped that having it in emacs-lisp would be enough, but perhaps
that's a too subtle hint? OK, I'll rename.
> I suggest to use names that make it more clear which of the two should
> be a single line. Maybe `title` and `commentary`?
Makes sense. Done.
>> +If CODE is non-nil (which is the default), a Code: line is
>> +inserted."
>
> Why would we ever want to not insert `Code:`?
miscdic/titdic inserts the Code itself after a whopping comment -- I
guess we could require that the callers put all the comments in
:comment, though.
> 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.
Very true. Now adjusted.
>> + ";; This file is part of GNU Emacs.\n\n")
>
> Hmm... this makes the function unusable for third party packages,
> doesn't it?
Perhaps it should be disablable?
(Note that after this adjustment, you may have to say "make bootstrap"
unfortunately, because I don't think all the dependencies here are
correct in our Makefiles...)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-05 15:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <165443980067.10742.1255334855562523988@vcs2.savannah.gnu.org>
[not found] ` <20220605143641.51EE9C009A8@vcs2.savannah.gnu.org>
2022-06-05 15:11 ` master 9d2f4a8d5a: Add convenience functions for generating Emacs Lisp files Stefan Monnier
2022-06-05 15:40 ` Lars Ingebrigtsen
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).