diff --git a/src/lisp/lcp.lisp b/src/lisp/lcp.lisp index 84736c9fe..514f2d242 100644 --- a/src/lisp/lcp.lisp +++ b/src/lisp/lcp.lisp @@ -22,6 +22,8 @@ (in-package #:lcp) (defconstant +whitespace-chars+ '(#\Newline #\Space #\Return #\Linefeed #\Tab)) +(defconstant +vim-read-only+ "vim: readonly") +(defconstant +emacs-read-only+ "-*- buffer-read-only: t; -*-") (defstruct raw-cpp (string "" :type string :read-only t)) @@ -1498,7 +1500,9 @@ written to CPP-OUT stream. This source file will include the provided HPP-FILE. Original LCP-FILE is used just to insert a comment about the source of the code generation." (with-open-file (out capnp-file :direction :output :if-exists :supersede) - (format out "# Autogenerated using LCP from '~A'~%# DO NOT EDIT!~2%" lcp-file) + (format out "~@{# ~A~%~}" +emacs-read-only+ +vim-read-only+) + (format out "# DO NOT EDIT! Generated using LCP from '~A'~2%" + (file-namestring lcp-file)) (format out "~A;~2%" capnp-id) (write-line "using Cxx = import \"/capnp/c++.capnp\";" out) (format out "$Cxx.namespace(\"~A::capnp\");~2%" *capnp-namespace*) @@ -1569,7 +1573,9 @@ file." ;; cpp-code. This allows us to generate code which may rely on ;; evaluation done after the code definition. (with-open-file (out hpp-file :direction :output :if-exists :supersede) - (format out "// Autogenerated using LCP from '~A'~%// DO NOT EDIT!~2%" lcp-file) + (format out "~@{// ~A~%~}" +emacs-read-only+ +vim-read-only+) + (format out "// DO NOT EDIT! Generated using LCP from '~A'~2%" + (file-namestring lcp-file)) (dolist (res (read-lcp lcp-file)) (write-line (cpp-code res) out))) (when *cpp-namespaces* @@ -1581,7 +1587,9 @@ file." ;; When we have either capnp or C++ code for the .cpp file, generate the .cpp file (when (or *cpp-impl* types-for-capnp) (with-open-file (out cpp-file :direction :output :if-exists :supersede) - (format out "// Autogenerated using LCP from '~A'~%// DO NOT EDIT!~2%" lcp-file) + (format out "~@{// ~A~%~}" +emacs-read-only+ +vim-read-only+) + (format out "// DO NOT EDIT! Generated using LCP from '~A'~2%" + (file-namestring lcp-file)) (format out "#include \"~A\"~2%" (file-namestring hpp-file)) ;; First output the C++ code from the user (let (open-namespaces)