16

Why do elisp files usually end with ;;; file.el ends here?

Is there some historical reason why this was useful? I've seen it recommended in elisp style guides and I still see it in modern elisp packages. auto-insert-mode also adds such a comment to new elisp files by default.

zck
  • 8,984
  • 2
  • 31
  • 65
Qudit
  • 828
  • 8
  • 16

1 Answers1

18

From the Emacs Documentation:

‘;;; filename ends here’

This is the footer line; it appears at the very end of the file. Its purpose is to enable people to detect truncated versions of the file from the lack of a footer line.

zck
  • 8,984
  • 2
  • 31
  • 65
  • 1
    Is there anything beyond that? It seems like a pretty weak reason. – Qudit May 04 '15 at 05:52
  • 7
    @Qudit Today, maybe so. I think it is a testament to the age of emacs. – Atsby May 04 '15 at 08:22
  • 3
    Nowadays it is essentially tradition, but back before reliable / always available internet connectivity it made a lot more sense. It also stems from the fact that elisp packages are generally shared as source files rather than some sort of binary that can easily be determined to be incomplete/corrupt. – glucas May 04 '15 at 13:55
  • 4
    @Qudit, also, people would share elisp code via email, and Emacs predates MIME, so there were no email attachments. You just pasted the code into the email message. It was useful to have a marker for the end of the elisp file. – cjm May 04 '15 at 18:13
  • What about "[` ends soon`](https://github.com/tarsius/magit-rockstar/blob/cbf91692f223dc78e79ad736567d52a057baaff9/magit-rockstar.el#L145)"? – mgalgs Jul 11 '15 at 23:22
  • @mgalgs no idea. You might want to ask tarsius, the maintainer of that repo. – zck Jul 12 '15 at 00:40