changeset 676: |
ca09f470abb3 |
parent 675: |
176715089769 |
child 677: |
585f14458a65 |
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Tue, 24 Sep 2024 20:57:47 -0400 |
files: |
.dir-locals.el emacs/default.el emacs/emacs.sk emacs/lib/sk.el emacs/makefile skelfile |
description: |
rm dir-locals and makefile, added dir-locals hacks in sk.el |
1.1--- a/.dir-locals.el Tue Sep 24 16:47:38 2024 -0400
1.2+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3@@ -1,8 +0,0 @@
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))))
2.1--- a/emacs/default.el Tue Sep 24 16:47:38 2024 -0400
2.2+++ b/emacs/default.el Tue Sep 24 20:57:47 2024 -0400
2.3@@ -365,10 +365,10 @@
2.4 (setq sh-basic-offset 2)
2.5
2.6 ;;; Graphviz
2.7-(use-package graphviz-dot-mode
2.8- :ensure t
2.9- :config
2.10- (setq graphviz-dot-indent-width 2))
2.11+;; (use-package graphviz-dot-mode
2.12+;; :ensure t
2.13+;; :config
2.14+;; (setq graphviz-dot-indent-width 2))
2.15 ;;; Comments
2.16 (defcustom prog-comment-keywords
2.17 '("TODO" "REVIEW" "FIX" "HACK" "RESEARCH")
2.18@@ -783,7 +783,7 @@
2.19 tramp-default-host "localhost")
2.20
2.21 ;;; Imenu
2.22-(use-package imenu-list :ensure t)
2.23+;; (use-package imenu-list :ensure t)
2.24
2.25 ;;; Org
2.26 (require 'org)
3.1--- a/emacs/emacs.sk Tue Sep 24 16:47:38 2024 -0400
3.2+++ b/emacs/emacs.sk Tue Sep 24 20:57:47 2024 -0400
3.3@@ -1,4 +1,3 @@
3.4-;;; core/lisp skel system
3.5 :name "core/emacs"
3.6 :path "emacs"
3.7 ;; :components ((:org "babel"))
4.1--- a/emacs/lib/sk.el Tue Sep 24 16:47:38 2024 -0400
4.2+++ b/emacs/lib/sk.el Tue Sep 24 20:57:47 2024 -0400
4.3@@ -150,11 +150,59 @@
4.4 (add-to-list 'auto-mode-alist '("skelfile" . skel-mode))
4.5 (add-to-list 'auto-mode-alist '("\\.sk" . skel-mode)))
4.6
4.7+(defun project-skelfile-path (&optional project)
4.8+ "Find skelfile associated with PROJECT. Defaults to current
4.9+directory and returns name of skelfile. When PROJECT is T uses
4.10+`project-current'."
4.11+ (let* ((dir (unless (eql t project) (expand-file-name (or project default-directory))))
4.12+ (project-root (project-root (project-current nil dir))))
4.13+ (or
4.14+ (when dir
4.15+ (cl-find-if
4.16+ (lambda (x)
4.17+ (when (string-match
4.18+ (rx (or "skelfile" (and (* any) ".sk")))
4.19+ (file-name-nondirectory x))
4.20+ x))
4.21+ (directory-files dir t)))
4.22+ (when project
4.23+ (cl-find-if (lambda (x)
4.24+ (when (string-match (rx (or "skelfile" (and (* any) ".sk")))
4.25+ (file-name-nondirectory x))
4.26+ x))
4.27+ (directory-files project-root t))))))
4.28+
4.29+(defun read-skelfile-bind (&optional project)
4.30+ (let ((buffer (find-file-noselect (project-skelfile-path project))))
4.31+ (with-current-buffer buffer
4.32+ (goto-char (point-min))
4.33+ (goto-char (search-forward-regexp (rx bol ":bind" (* space))))
4.34+ (read buffer))))
4.35+
4.36+(defun project-skelfile-dir-locals (&optional project)
4.37+ "Return a list of dir-local bindings from a skelfile."
4.38+ (let ((form (read-skelfile-bind project)))
4.39+ (cl-loop for f in form
4.40+ do (cond
4.41+ ((eql (car f) :dir-locals) (cl-return (cdr f)))
4.42+ ;; when used as second element, the first is the name
4.43+ ;; of the CL-local binding, here we discard it and
4.44+ ;; just take the CDDR.
4.45+ ((eql (cadr f) :dir-locals) (cl-return (cddr f)))))))
4.46+
4.47 (defun skel-dir-local--get-variables ()
4.48 "Compute and return the list of :DIR-LOCAL bindings found in the current
4.49 project's skelfile, if any. Typically added to
4.50 `hack-dir-local--get-variables'."
4.51- )
4.52+ (let ((root (project-root (project-current))))
4.53+ (cons (expand-file-name root) (project-skelfile-dir-locals root))))
4.54+
4.55+(defun %skel-dir-local--get-variables ()
4.56+ (let ((root (expand-file-name (project-root (project-current)))))
4.57+ (unless (assoc-string root dir-locals-class-alist)
4.58+ (push (skel-dir-local--get-variables) dir-locals-class-alist))))
4.59+
4.60+(add-hook 'skel-minor-mode-hook '%skel-dir-local--get-variables)
4.61
4.62 (provide 'skel)
4.63 (provide 'sk)
5.1--- a/emacs/makefile Tue Sep 24 16:47:38 2024 -0400
5.2+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3@@ -1,6 +0,0 @@
5.4-DOTEMACS:=$(HOME)/.emacs.d
5.5-install:$(wildcard *.el) lib
5.6- mkdir -pv $(DOTEMACS)
5.7- cp -rf $^ $(DOTEMACS)/
5.8-.PHONY: c
5.9-clean:;rm -rf $(DOTEMACS)/{*.el,lisp,site-lisp}
6.1--- a/skelfile Tue Sep 24 16:47:38 2024 -0400
6.2+++ b/skelfile Tue Sep 24 20:57:47 2024 -0400
6.3@@ -12,14 +12,14 @@
6.4 :bind ((stash ".stash")
6.5 ;; (cc :env "clang")
6.6 (emacs-locals :dir-locals
6.7- (nil . ((indent-tabs-mode . nil)))
6.8- (rust-mode . ((eglot-workspace-configuration
6.9- . (:rust-analyzer (:cargo (:buildScripts (:enable t) (:features "all")))))))
6.10- (nushell-mode . ((nushell-indent-offset . 2)))
6.11- (nushell-ts-mode . ((nushell-indent-offset . 2)))
6.12- (sh-mode . (sh-indentation . 2))
6.13- (makefile-mode . ((indent-tabs-mode . t)))
6.14- (slint-mode . ((slint-indent-level . 2)))))
6.15+ (nil . ((indent-tabs-mode . nil)))
6.16+ (rust-mode . ((eglot-workspace-configuration
6.17+ . (:rust-analyzer (:cargo (:buildScripts (:enable t) (:features "all")))))))
6.18+ (nushell-mode . ((nushell-indent-offset . 2)))
6.19+ (nushell-ts-mode . ((nushell-indent-offset . 2)))
6.20+ (sh-mode . (sh-indentation . 2))
6.21+ (makefile-mode . ((indent-tabs-mode . t)))
6.22+ (slint-mode . ((slint-indent-level . 2)))))
6.23 :components ((:org "readme")
6.24 (:mod "emacs")
6.25 (:mod "lisp")