aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-12 09:34:44 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-13 12:51:59 -0700
commitd7367761b2a020efb58c5a706872c97aa3410c95 (patch)
tree36243148fe023806a19a3318434055f17244056e
parent4af924ecc6251b3fb919fcc8bf2e7185072a929c (diff)
downloadconsfigurator-d7367761b2a020efb58c5a706872c97aa3410c95.tar.gz
build consfigurator.el entirely from Lisp
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--emacs/Makefile11
-rw-r--r--src/property.lisp25
2 files changed, 18 insertions, 18 deletions
diff --git a/emacs/Makefile b/emacs/Makefile
index 3f9309c..2226d2c 100644
--- a/emacs/Makefile
+++ b/emacs/Makefile
@@ -2,13 +2,6 @@ LOAD = '(let ((asdf:*user-cache* "/tmp") \
(asdf:*central-registry* (list (truename "..")))) \
(asdf:load-system "consfigurator"))'
-SUBSTITUTE = 'BEGIN { open FH, "<", "put-forms.el"; \
- chomp($$forms = join "", map s/^/ /r, grep /^\(put/, <FH>) } \
- s/ \@putforms@/$$forms/'
-
-consfigurator.el: consfigurator.el.in put-forms.el
- perl -wpe$(SUBSTITUTE) consfigurator.el.in >consfigurator.el
-
-put-forms.el:
+consfigurator.el: consfigurator.el.in
sbcl --disable-debugger --eval '(require "asdf")' --eval $(LOAD) \
- --eval '(consfigurator::dump-properties-for-emacs "$@")' --quit
+ --eval '(consfigurator::dump-properties-for-emacs "$<" "$@")' --quit
diff --git a/src/property.lisp b/src/property.lisp
index 56d8b72..82d1b92 100644
--- a/src/property.lisp
+++ b/src/property.lisp
@@ -107,15 +107,22 @@
(defvar *properties-for-emacs* nil
"List of properties whose symbols have Emacs indentation information.")
-(defun dump-properties-for-emacs (file)
- (with-open-file (s file :direction :output :if-exists :supersede)
- (format s ";; automatically generated by~%")
- (format s ";; CONSFIGURATOR::DUMP-PROPERTIES-FOR-EMACS; do not edit~%~%")
- (loop for (prop . indent) in (nreverse
- (mappend (lambda (s) (get s 'indent))
- *properties-for-emacs*))
- do (format s "(put '~A 'common-lisp-indent-function '~A)~%"
- prop indent))))
+(defun dump-properties-for-emacs (from to)
+ (let ((put-forms
+ (stripln
+ (with-output-to-string (s)
+ (loop
+ for (prop . indent)
+ in (nreverse (mappend (lambda (s) (get s 'indent))
+ *properties-for-emacs*))
+ do (format s " (put '~A 'common-lisp-indent-function '~A)~%"
+ prop indent))))))
+ (with-open-file (in from)
+ (with-open-file (out to :direction :output :if-exists :supersede)
+ (loop for line = (read-line in nil)
+ while line
+ do (princ (re:regex-replace " @putforms@" line put-forms) out)
+ (terpri out))))))
(defun store-indentation-info-for-emacs (sym args &optional info)
(let* ((short-name