changelog shortlog graph tags branches files raw help

Mercurial > core / changeset: add dir-locals to skel, fix package lock violation in castable, move .sk files

changeset 670: 6856c021d084
parent 669: 3966d52b0b2f
child 671: 1f065ead57ca
author: Richard Westhaver <ellis@rwest.io>
date: Mon, 23 Sep 2024 21:14:10 -0400
files: .dir-locals.el emacs.sk emacs/emacs.sk emacs/lib/sk.el lisp.sk lisp/lib/obj/hash/castable.lisp lisp/lib/skel/core/obj.lisp lisp/lisp.sk lisp/std/stream.lisp rust.sk rust/rust.sk skelfile
description: add dir-locals to skel, fix package lock violation in castable, move .sk files
     1.1--- a/.dir-locals.el	Mon Sep 23 19:20:00 2024 -0400
     1.2+++ b/.dir-locals.el	Mon Sep 23 21:14:10 2024 -0400
     1.3@@ -1,8 +1,8 @@
     1.4 ((nil . ((indent-tabs-mode . nil)))
     1.5- (rust-mode . ((eglot-workspace-configuration
     1.6-                . (:rust-analyzer (:cargo (:buildScripts (:enable t) (:features "all")))))))
     1.7- (nushell-mode . ((nushell-indent-offset . 2)))
     1.8- (nushell-ts-mode . ((nushell-indent-offset . 2)))
     1.9- (sh-mode . (sh-indentation . 2))
    1.10- (makefile-mode . ((indent-tabs-mode . t)))
    1.11- (slint-mode . ((slint-indent-level . 2))))
    1.12+(rust-mode . ((eglot-workspace-configuration
    1.13+               . (:rust-analyzer (:cargo (:buildScripts (:enable t) (:features "all")))))))
    1.14+(nushell-mode . ((nushell-indent-offset . 2)))
    1.15+(nushell-ts-mode . ((nushell-indent-offset . 2)))
    1.16+(sh-mode . (sh-indentation . 2))
    1.17+(makefile-mode . ((indent-tabs-mode . t)))
    1.18+(slint-mode . ((slint-indent-level . 2))))
     2.1--- a/emacs.sk	Mon Sep 23 19:20:00 2024 -0400
     2.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3@@ -1,27 +0,0 @@
     2.4-;;; core/lisp skel system
     2.5-:name "core/emacs"
     2.6-:path "emacs"
     2.7-;; :components ((:org "babel"))
     2.8-:bind ((dotemacs (merge-pathnames ".emacs.d/" (user-homedir-pathname)))
     2.9-       (config () (directory "emacs/*.el"))
    2.10-       (lib () (directory "emacs/lib/*.el")))
    2.11-:rules 
    2.12-((install ()
    2.13-          (mapcar
    2.14-           (lambda (el)
    2.15-             (std:with-open-files
    2.16-                 ((in el :direction :input)
    2.17-                  (out (merge-pathnames (file-namestring el) dotemacs) :direction :output))
    2.18-               (std:copy-stream in out :finish-output t)))
    2.19-           config)
    2.20-          (mapcar
    2.21-           (lambda (el)
    2.22-             (std:with-open-files
    2.23-                 ((in el :direction :input)
    2.24-                  (out (merge-pathnames (file-namestring el) 
    2.25-                                        (ensure-directories-exist 
    2.26-                                         (merge-pathnames "lib/" dotemacs))) 
    2.27-                       :direction :output))
    2.28-               (std:copy-stream in out :finish-output t)))
    2.29-           lib)))
    2.30-                 
     3.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2+++ b/emacs/emacs.sk	Mon Sep 23 21:14:10 2024 -0400
     3.3@@ -0,0 +1,33 @@
     3.4+;;; core/lisp skel system
     3.5+:name "core/emacs"
     3.6+:path "emacs"
     3.7+;; :components ((:org "babel"))
     3.8+;; TODO 2024-09-23: 
     3.9+:bind ((dotemacs (merge-pathnames ".emacs.d/" (user-homedir-pathname)))
    3.10+       (config (directory "emacs/*.el"))
    3.11+       (lib (directory "emacs/lib/*.el")))
    3.12+:rules 
    3.13+((install ()
    3.14+          (flet ((el-write (in out)
    3.15+                   (let* ((fn (file-namestring in)))
    3.16+                     (println (format nil "~A -> ~A" fn out))
    3.17+                     (std:with-open-files
    3.18+                         ((in in :direction :input)
    3.19+                          (out out :direction :output :if-exists :supersede))
    3.20+                       (std:copy-stream in out :finish-output t)))))
    3.21+          (let ((dotemacs (merge-pathnames ".emacs.d/" (user-homedir-pathname)))
    3.22+                (config (directory "*.el"))
    3.23+                (lib (directory "lib/*.el")))
    3.24+            (mapcar
    3.25+             (lambda (el)
    3.26+               (el-write el (merge-pathnames (file-namestring el) dotemacs)))
    3.27+             config)
    3.28+            (mapcar
    3.29+             (lambda (el)
    3.30+               (el-write el 
    3.31+                         (merge-pathnames (file-namestring el)
    3.32+                                          (ensure-directories-exist 
    3.33+                                           (merge-pathnames "lib/" dotemacs)))))
    3.34+             lib))))
    3.35+ (clean () #$rm -rf ~/.emacs.d/{*.el,lisp,site-lisp,lib,elpa$#))
    3.36+                 
     4.1--- a/emacs/lib/sk.el	Mon Sep 23 19:20:00 2024 -0400
     4.2+++ b/emacs/lib/sk.el	Mon Sep 23 21:14:10 2024 -0400
     4.3@@ -148,7 +148,7 @@
     4.4   "Initialize the skel library."
     4.5   (interactive)
     4.6   (add-to-list 'auto-mode-alist '("skelfile" . skel-mode))
     4.7-  (add-to-list 'auto-mode-alist '("\\.sk\\'" . skel-mode)))
     4.8+  (add-to-list 'auto-mode-alist '("\\.sk" . skel-mode)))
     4.9 
    4.10 (provide 'skel)
    4.11 (provide 'sk)
     5.1--- a/lisp.sk	Mon Sep 23 19:20:00 2024 -0400
     5.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3@@ -1,10 +0,0 @@
     5.4-;;; lisp.sk --- core/lisp skelfile -*- mode: skel; -*-
     5.5-:name "core/lisp"
     5.6-:src "lisp"
     5.7-:description "CC Lisp Core"
     5.8-:components
     5.9-((:asd "prelude")
    5.10- (:asd "user")
    5.11- (:asd "core")
    5.12- (:mod "std" (:asd "std")))
    5.13-       
     6.1--- a/lisp/lib/obj/hash/castable.lisp	Mon Sep 23 19:20:00 2024 -0400
     6.2+++ b/lisp/lib/obj/hash/castable.lisp	Mon Sep 23 21:14:10 2024 -0400
     6.3@@ -281,7 +281,8 @@
     6.4     (setf (%castable-reprobes table) (make-counter))))
     6.5 
     6.6 (defun determine-hasher (test)
     6.7-  (or (cond ((eq test #'eq) #'sb-impl::eq-hash)
     6.8+  ;; TODO 2024-09-23: 
     6.9+  (or (cond ;; ((eq test #'eq) #'sb-impl::eq-hash) ;; package-lock violation
    6.10             ((eq test #'eql) #'sb-impl::eql-hash)
    6.11             ((eq test #'equal) #'sb-impl::equal-hash)
    6.12             ((eq test #'equalp) #'sb-impl::equalp-hash)
     7.1--- a/lisp/lib/skel/core/obj.lisp	Mon Sep 23 19:20:00 2024 -0400
     7.2+++ b/lisp/lib/skel/core/obj.lisp	Mon Sep 23 21:14:10 2024 -0400
     7.3@@ -402,6 +402,41 @@
     7.4   (when (consp recipe)
     7.5     (every '%recipe-phase-p recipe)))
     7.6 
     7.7+(defun sk-case-bind (key val &optional sym)
     7.8+  "Switch on keyword KEY, evaluating a skel binding."
     7.9+  (case key
    7.10+    (:dir-locals
    7.11+     ;; nothing actually needs to be done here, the value itself can be parsed
    7.12+     ;; directly from emacs via sk.el package. For convenience, when SYM is
    7.13+     ;; present we bind it to the list of variables.
    7.14+     (when sym (list sym val)))
    7.15+    (:hook
    7.16+     ;; process the remainder of the form as specializer+body
    7.17+     (destructuring-bind (spec &rest body) val
    7.18+       (declare (ignore spec body))
    7.19+       (nyi!)))
    7.20+    (:cmd
    7.21+     ;; process the remainder as spec+defcmd-args+body
    7.22+     )
    7.23+    (:opt
    7.24+     ;; process the remainder as spec+defcmd-args+body
    7.25+     )
    7.26+    (:env
    7.27+     ;; process the remainder as a regular value but
    7.28+     ;; associate the name with a shell environment which
    7.29+     ;; is set to the value. If the cdr is of length 3
    7.30+     ;; then we simply remember the value and set it during
    7.31+     ;; any calls out from Lisp to the shell. When the form
    7.32+     ;; length is > 3 we parse the next value as a shell
    7.33+     ;; specification with additional options for checking
    7.34+     ;; for pre-existing values and 'exporting' the
    7.35+     ;; environment.
    7.36+     (if (= (length val) 1)
    7.37+         ;; TODO 2024-09-21: setenv
    7.38+         (list sym val)
    7.39+         ;; process additional shell opts
    7.40+         (nyi!)))))
    7.41+
    7.42 ;; ast -> obj
    7.43 (defmethod load-ast ((self sk-project))
    7.44   ;; internal ast is never tagged
    7.45@@ -470,44 +505,23 @@
    7.46                   (let ((ret))
    7.47                     ;; TODO 2024-09-21: 
    7.48                     (dolist (b bind ret)
    7.49-                      ;; if this is a list of length > 2 we parse the form as (sym props val)
    7.50+                      ;; if this is a list of length > 2 we parse the form as either
    7.51+                      ;; (key &rest val) or (var param &rest val)
    7.52                       (let ((sym (car b))
    7.53-                            (form (cddr b)))
    7.54-                        (cond 
    7.55-                          ((> (length form) 0)
    7.56-                           (let ((key? (cadr b)))
    7.57-                             (if (keywordp key?)
    7.58-                                 (case key?
    7.59-                                   (:hook
    7.60-                                    ;; process the remainder of the form as specializer+body
    7.61-                                    (destructuring-bind (spec &rest body) form
    7.62-                                      (declare (ignore spec body))
    7.63-                                      (nyi!)))
    7.64-                                   (:cmd
    7.65-                                    ;; process the remainder as spec+defcmd-args+body
    7.66-                                    )
    7.67-                                   (:opt
    7.68-                                    ;; process the remainder as spec+defcmd-args+body
    7.69-                                    )
    7.70-                                   (:env
    7.71-                                    ;; process the remainder as a regular value but
    7.72-                                    ;; associate the name with a shell environment which
    7.73-                                    ;; is set to the value. If the cdr is of length 3
    7.74-                                    ;; then we simply remember the value and set it during
    7.75-                                    ;; any calls out from Lisp to the shell. When the form
    7.76-                                    ;; length is > 3 we parse the next value as a shell
    7.77-                                    ;; specification with additional options for checking
    7.78-                                    ;; for pre-existing values and 'exporting' the
    7.79-                                    ;; environment.
    7.80-                                    (if (= (length form) 1)
    7.81-                                        ;; TODO 2024-09-21: setenv
    7.82-                                        (push (list sym (car form)) ret)
    7.83-                                        ;; process additional shell opts
    7.84-                                        (nyi!))))
    7.85-                                 ;; else we assume that a function is being defined
    7.86-                                 (push `(,sym ,(compile sym `(lambda ,(cadr b) ,@(cddr b)))) ret))))
    7.87-                          (t
    7.88-                           (push b ret))))))))
    7.89+                            (form (cdr b)))
    7.90+                            ;; (form (cddr b)))
    7.91+                        (if (keywordp sym)
    7.92+                            (sk-case-bind sym form)
    7.93+                            (cond 
    7.94+                              ;; (sym param &rest val) detected
    7.95+                              ((> (length (cdr form)) 0)
    7.96+                               (let ((key (cadr b)))
    7.97+                                 (if (keywordp key)
    7.98+                                     (sk-case-bind key form sym)
    7.99+                                     ;; if nothing else mube be a lambda
   7.100+                                     (push `(,sym ,(compile sym `(lambda ,(cadr b) ,@(cddr b)))) ret))))
   7.101+                              (t
   7.102+                               (push b ret)))))))))
   7.103           ;; RULES
   7.104           (when-let ((rules (sk-rules self)))
   7.105             (setf (sk-rules self)
     8.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2+++ b/lisp/lisp.sk	Mon Sep 23 21:14:10 2024 -0400
     8.3@@ -0,0 +1,10 @@
     8.4+;;; lisp.sk --- core/lisp skelfile -*- mode: skel; -*-
     8.5+:name "core/lisp"
     8.6+:src "lisp"
     8.7+:description "CC Lisp Core"
     8.8+:components
     8.9+((:asd "prelude")
    8.10+ (:asd "user")
    8.11+ (:asd "core")
    8.12+ (:mod "std" (:asd "std")))
    8.13+       
     9.1--- a/lisp/std/stream.lisp	Mon Sep 23 19:20:00 2024 -0400
     9.2+++ b/lisp/std/stream.lisp	Mon Sep 23 21:14:10 2024 -0400
     9.3@@ -42,9 +42,9 @@
     9.4                      (error "~@<Could not read enough bytes from the input to fulfill ~
     9.5                           the :END ~S requirement in ~S.~:@>" 'copy-stream end)
     9.6                      (return)))
     9.7-               (print (incf input-position n))
     9.8+               (incf input-position n)
     9.9                (write-sequence buffer output :end n)
    9.10-               (print (incf output-position n))))
    9.11+               (incf output-position n)))
    9.12     (when finish-output
    9.13       (finish-output output))
    9.14     output-position))
    10.1--- a/rust.sk	Mon Sep 23 19:20:00 2024 -0400
    10.2+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3@@ -1,7 +0,0 @@
    10.4-;;; rust.sk --- core/rust skelfile -*- mode: skel; -*-
    10.5-:name "core/rust"
    10.6-:description "CC Rust Core"
    10.7-:src "rust"
    10.8-:components ((:rust-system "Cargo.toml"))
    10.9-:rules 
   10.10-(("clean" () #$cargo clean$#))
    11.1--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2+++ b/rust/rust.sk	Mon Sep 23 21:14:10 2024 -0400
    11.3@@ -0,0 +1,7 @@
    11.4+;;; rust.sk --- core/rust skelfile -*- mode: skel; -*-
    11.5+:name "core/rust"
    11.6+:description "CC Rust Core"
    11.7+:src "rust"
    11.8+:components ((:rust-system "Cargo.toml"))
    11.9+:rules 
   11.10+(("clean" () #$cargo clean$#))
    12.1--- a/skelfile	Mon Sep 23 19:20:00 2024 -0400
    12.2+++ b/skelfile	Mon Sep 23 21:14:10 2024 -0400
    12.3@@ -7,12 +7,23 @@
    12.4 :store ".store"
    12.5 :description "The Compiler Company Core"
    12.6 :tags ("core" "lisp" "rust" "emacs" "c")
    12.7-:include ("lisp.sk" "rust.sk" "emacs.sk")
    12.8+:include ("lisp/lisp.sk" "rust/rust.sk" "emacs/emacs.sk")
    12.9 :vc (:hg "https://vc.compiler.company/core")
   12.10 :bind ((stash ".stash")
   12.11-       (cc :env "clang"))
   12.12-:components ((:dir-locals ".dir-locals")
   12.13-             (:org "readme"))
   12.14+       ;; (cc :env "clang")
   12.15+       (emacs-locals :dir-locals
   12.16+        (nil . ((indent-tabs-mode . nil)))
   12.17+        (rust-mode . ((eglot-workspace-configuration
   12.18+                       . (:rust-analyzer (:cargo (:buildScripts (:enable t) (:features "all")))))))
   12.19+        (nushell-mode . ((nushell-indent-offset . 2)))
   12.20+        (nushell-ts-mode . ((nushell-indent-offset . 2)))
   12.21+        (sh-mode . (sh-indentation . 2))
   12.22+        (makefile-mode . ((indent-tabs-mode . t)))
   12.23+        (slint-mode . ((slint-indent-level . 2)))))
   12.24+:components ((:org "readme")
   12.25+             (:mod "emacs")
   12.26+             (:mod "lisp")
   12.27+             (:mod "rust"))
   12.28 :rules
   12.29 ((all (%stash
   12.30        psl.dat parquet.json rgb.txt