# HG changeset patch # User Richard Westhaver # Date 1727140450 14400 # Node ID 6856c021d084116b1dc7d3b13f1d58c5ed99144c # Parent 3966d52b0b2f4efd696a437134f10f0179e7818a add dir-locals to skel, fix package lock violation in castable, move .sk files diff -r 3966d52b0b2f -r 6856c021d084 .dir-locals.el --- a/.dir-locals.el Mon Sep 23 19:20:00 2024 -0400 +++ b/.dir-locals.el Mon Sep 23 21:14:10 2024 -0400 @@ -1,8 +1,8 @@ ((nil . ((indent-tabs-mode . nil))) - (rust-mode . ((eglot-workspace-configuration - . (:rust-analyzer (:cargo (:buildScripts (:enable t) (:features "all"))))))) - (nushell-mode . ((nushell-indent-offset . 2))) - (nushell-ts-mode . ((nushell-indent-offset . 2))) - (sh-mode . (sh-indentation . 2)) - (makefile-mode . ((indent-tabs-mode . t))) - (slint-mode . ((slint-indent-level . 2)))) +(rust-mode . ((eglot-workspace-configuration + . (:rust-analyzer (:cargo (:buildScripts (:enable t) (:features "all"))))))) +(nushell-mode . ((nushell-indent-offset . 2))) +(nushell-ts-mode . ((nushell-indent-offset . 2))) +(sh-mode . (sh-indentation . 2)) +(makefile-mode . ((indent-tabs-mode . t))) +(slint-mode . ((slint-indent-level . 2)))) diff -r 3966d52b0b2f -r 6856c021d084 emacs.sk --- a/emacs.sk Mon Sep 23 19:20:00 2024 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -;;; core/lisp skel system -:name "core/emacs" -:path "emacs" -;; :components ((:org "babel")) -:bind ((dotemacs (merge-pathnames ".emacs.d/" (user-homedir-pathname))) - (config () (directory "emacs/*.el")) - (lib () (directory "emacs/lib/*.el"))) -:rules -((install () - (mapcar - (lambda (el) - (std:with-open-files - ((in el :direction :input) - (out (merge-pathnames (file-namestring el) dotemacs) :direction :output)) - (std:copy-stream in out :finish-output t))) - config) - (mapcar - (lambda (el) - (std:with-open-files - ((in el :direction :input) - (out (merge-pathnames (file-namestring el) - (ensure-directories-exist - (merge-pathnames "lib/" dotemacs))) - :direction :output)) - (std:copy-stream in out :finish-output t))) - lib))) - diff -r 3966d52b0b2f -r 6856c021d084 emacs/emacs.sk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emacs/emacs.sk Mon Sep 23 21:14:10 2024 -0400 @@ -0,0 +1,33 @@ +;;; core/lisp skel system +:name "core/emacs" +:path "emacs" +;; :components ((:org "babel")) +;; TODO 2024-09-23: +:bind ((dotemacs (merge-pathnames ".emacs.d/" (user-homedir-pathname))) + (config (directory "emacs/*.el")) + (lib (directory "emacs/lib/*.el"))) +:rules +((install () + (flet ((el-write (in out) + (let* ((fn (file-namestring in))) + (println (format nil "~A -> ~A" fn out)) + (std:with-open-files + ((in in :direction :input) + (out out :direction :output :if-exists :supersede)) + (std:copy-stream in out :finish-output t))))) + (let ((dotemacs (merge-pathnames ".emacs.d/" (user-homedir-pathname))) + (config (directory "*.el")) + (lib (directory "lib/*.el"))) + (mapcar + (lambda (el) + (el-write el (merge-pathnames (file-namestring el) dotemacs))) + config) + (mapcar + (lambda (el) + (el-write el + (merge-pathnames (file-namestring el) + (ensure-directories-exist + (merge-pathnames "lib/" dotemacs))))) + lib)))) + (clean () #$rm -rf ~/.emacs.d/{*.el,lisp,site-lisp,lib,elpa$#)) + diff -r 3966d52b0b2f -r 6856c021d084 emacs/lib/sk.el --- a/emacs/lib/sk.el Mon Sep 23 19:20:00 2024 -0400 +++ b/emacs/lib/sk.el Mon Sep 23 21:14:10 2024 -0400 @@ -148,7 +148,7 @@ "Initialize the skel library." (interactive) (add-to-list 'auto-mode-alist '("skelfile" . skel-mode)) - (add-to-list 'auto-mode-alist '("\\.sk\\'" . skel-mode))) + (add-to-list 'auto-mode-alist '("\\.sk" . skel-mode))) (provide 'skel) (provide 'sk) diff -r 3966d52b0b2f -r 6856c021d084 lisp.sk --- a/lisp.sk Mon Sep 23 19:20:00 2024 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -;;; lisp.sk --- core/lisp skelfile -*- mode: skel; -*- -:name "core/lisp" -:src "lisp" -:description "CC Lisp Core" -:components -((:asd "prelude") - (:asd "user") - (:asd "core") - (:mod "std" (:asd "std"))) - diff -r 3966d52b0b2f -r 6856c021d084 lisp/lib/obj/hash/castable.lisp --- a/lisp/lib/obj/hash/castable.lisp Mon Sep 23 19:20:00 2024 -0400 +++ b/lisp/lib/obj/hash/castable.lisp Mon Sep 23 21:14:10 2024 -0400 @@ -281,7 +281,8 @@ (setf (%castable-reprobes table) (make-counter)))) (defun determine-hasher (test) - (or (cond ((eq test #'eq) #'sb-impl::eq-hash) + ;; TODO 2024-09-23: + (or (cond ;; ((eq test #'eq) #'sb-impl::eq-hash) ;; package-lock violation ((eq test #'eql) #'sb-impl::eql-hash) ((eq test #'equal) #'sb-impl::equal-hash) ((eq test #'equalp) #'sb-impl::equalp-hash) diff -r 3966d52b0b2f -r 6856c021d084 lisp/lib/skel/core/obj.lisp --- a/lisp/lib/skel/core/obj.lisp Mon Sep 23 19:20:00 2024 -0400 +++ b/lisp/lib/skel/core/obj.lisp Mon Sep 23 21:14:10 2024 -0400 @@ -402,6 +402,41 @@ (when (consp recipe) (every '%recipe-phase-p recipe))) +(defun sk-case-bind (key val &optional sym) + "Switch on keyword KEY, evaluating a skel binding." + (case key + (:dir-locals + ;; nothing actually needs to be done here, the value itself can be parsed + ;; directly from emacs via sk.el package. For convenience, when SYM is + ;; present we bind it to the list of variables. + (when sym (list sym val))) + (:hook + ;; process the remainder of the form as specializer+body + (destructuring-bind (spec &rest body) val + (declare (ignore spec body)) + (nyi!))) + (:cmd + ;; process the remainder as spec+defcmd-args+body + ) + (:opt + ;; process the remainder as spec+defcmd-args+body + ) + (:env + ;; process the remainder as a regular value but + ;; associate the name with a shell environment which + ;; is set to the value. If the cdr is of length 3 + ;; then we simply remember the value and set it during + ;; any calls out from Lisp to the shell. When the form + ;; length is > 3 we parse the next value as a shell + ;; specification with additional options for checking + ;; for pre-existing values and 'exporting' the + ;; environment. + (if (= (length val) 1) + ;; TODO 2024-09-21: setenv + (list sym val) + ;; process additional shell opts + (nyi!))))) + ;; ast -> obj (defmethod load-ast ((self sk-project)) ;; internal ast is never tagged @@ -470,44 +505,23 @@ (let ((ret)) ;; TODO 2024-09-21: (dolist (b bind ret) - ;; if this is a list of length > 2 we parse the form as (sym props val) + ;; if this is a list of length > 2 we parse the form as either + ;; (key &rest val) or (var param &rest val) (let ((sym (car b)) - (form (cddr b))) - (cond - ((> (length form) 0) - (let ((key? (cadr b))) - (if (keywordp key?) - (case key? - (:hook - ;; process the remainder of the form as specializer+body - (destructuring-bind (spec &rest body) form - (declare (ignore spec body)) - (nyi!))) - (:cmd - ;; process the remainder as spec+defcmd-args+body - ) - (:opt - ;; process the remainder as spec+defcmd-args+body - ) - (:env - ;; process the remainder as a regular value but - ;; associate the name with a shell environment which - ;; is set to the value. If the cdr is of length 3 - ;; then we simply remember the value and set it during - ;; any calls out from Lisp to the shell. When the form - ;; length is > 3 we parse the next value as a shell - ;; specification with additional options for checking - ;; for pre-existing values and 'exporting' the - ;; environment. - (if (= (length form) 1) - ;; TODO 2024-09-21: setenv - (push (list sym (car form)) ret) - ;; process additional shell opts - (nyi!)))) - ;; else we assume that a function is being defined - (push `(,sym ,(compile sym `(lambda ,(cadr b) ,@(cddr b)))) ret)))) - (t - (push b ret)))))))) + (form (cdr b))) + ;; (form (cddr b))) + (if (keywordp sym) + (sk-case-bind sym form) + (cond + ;; (sym param &rest val) detected + ((> (length (cdr form)) 0) + (let ((key (cadr b))) + (if (keywordp key) + (sk-case-bind key form sym) + ;; if nothing else mube be a lambda + (push `(,sym ,(compile sym `(lambda ,(cadr b) ,@(cddr b)))) ret)))) + (t + (push b ret))))))))) ;; RULES (when-let ((rules (sk-rules self))) (setf (sk-rules self) diff -r 3966d52b0b2f -r 6856c021d084 lisp/lisp.sk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/lisp.sk Mon Sep 23 21:14:10 2024 -0400 @@ -0,0 +1,10 @@ +;;; lisp.sk --- core/lisp skelfile -*- mode: skel; -*- +:name "core/lisp" +:src "lisp" +:description "CC Lisp Core" +:components +((:asd "prelude") + (:asd "user") + (:asd "core") + (:mod "std" (:asd "std"))) + diff -r 3966d52b0b2f -r 6856c021d084 lisp/std/stream.lisp --- a/lisp/std/stream.lisp Mon Sep 23 19:20:00 2024 -0400 +++ b/lisp/std/stream.lisp Mon Sep 23 21:14:10 2024 -0400 @@ -42,9 +42,9 @@ (error "~@" 'copy-stream end) (return))) - (print (incf input-position n)) + (incf input-position n) (write-sequence buffer output :end n) - (print (incf output-position n)))) + (incf output-position n))) (when finish-output (finish-output output)) output-position)) diff -r 3966d52b0b2f -r 6856c021d084 rust.sk --- a/rust.sk Mon Sep 23 19:20:00 2024 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -;;; rust.sk --- core/rust skelfile -*- mode: skel; -*- -:name "core/rust" -:description "CC Rust Core" -:src "rust" -:components ((:rust-system "Cargo.toml")) -:rules -(("clean" () #$cargo clean$#)) diff -r 3966d52b0b2f -r 6856c021d084 rust/rust.sk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rust/rust.sk Mon Sep 23 21:14:10 2024 -0400 @@ -0,0 +1,7 @@ +;;; rust.sk --- core/rust skelfile -*- mode: skel; -*- +:name "core/rust" +:description "CC Rust Core" +:src "rust" +:components ((:rust-system "Cargo.toml")) +:rules +(("clean" () #$cargo clean$#)) diff -r 3966d52b0b2f -r 6856c021d084 skelfile --- a/skelfile Mon Sep 23 19:20:00 2024 -0400 +++ b/skelfile Mon Sep 23 21:14:10 2024 -0400 @@ -7,12 +7,23 @@ :store ".store" :description "The Compiler Company Core" :tags ("core" "lisp" "rust" "emacs" "c") -:include ("lisp.sk" "rust.sk" "emacs.sk") +:include ("lisp/lisp.sk" "rust/rust.sk" "emacs/emacs.sk") :vc (:hg "https://vc.compiler.company/core") :bind ((stash ".stash") - (cc :env "clang")) -:components ((:dir-locals ".dir-locals") - (:org "readme")) + ;; (cc :env "clang") + (emacs-locals :dir-locals + (nil . ((indent-tabs-mode . nil))) + (rust-mode . ((eglot-workspace-configuration + . (:rust-analyzer (:cargo (:buildScripts (:enable t) (:features "all"))))))) + (nushell-mode . ((nushell-indent-offset . 2))) + (nushell-ts-mode . ((nushell-indent-offset . 2))) + (sh-mode . (sh-indentation . 2)) + (makefile-mode . ((indent-tabs-mode . t))) + (slint-mode . ((slint-indent-level . 2))))) +:components ((:org "readme") + (:mod "emacs") + (:mod "lisp") + (:mod "rust")) :rules ((all (%stash psl.dat parquet.json rgb.txt