From e3c96baa662c85ac41acd067466834c61701b0e3 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Sun, 29 Aug 2021 19:44:18 +0100 Subject: [PATCH] Add terraform andt several more cubes --- Makefile | 11 ++++++++ config/fg42.user.v3.el | 7 ++++-- core/cubes/editor.el | 19 +++++++++++++- core/cubes/git.el | 3 +-- core/cubes/org.el | 23 +++++++++-------- core/cubes/terraform.el | 56 +++++++++++++++++++++++++++++++++++++++++ dev.org | 1 + fg42-config.el | 2 +- 8 files changed, 106 insertions(+), 16 deletions(-) create mode 100644 core/cubes/terraform.el diff --git a/Makefile b/Makefile index 662f2dc..f55e455 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ install-ci: @echo "Creating the link..." @echo "#! /bin/sh" > ./fg42 @echo "export FG42_HOME=$(shell pwd)" >> ./fg42 + @echo "# export LIBRARY_PATH=/path/to/libgccjit.so" >> ./fg42 @echo 'emacs --name FG42 --no-site-file --no-site-lisp --no-splash --title FG42 -l $$FG42_HOME/fg42-config.el "$$@"' >> ./fg42 @chmod +x ./fg42 @@ -28,6 +29,8 @@ install: @cp ./scripts/fg42-wm ./fg42-wm @echo "export FG42_HOME=$(shell pwd)" >> ./fg42 @echo "export FG42_HOME=$(shell pwd)" >> ./fg42-wm + @echo "# export LIBRARY_PATH=/path/to/libgccjit.so" >> ./fg42 + @echo "# export LIBRARY_PATH=/path/to/libgccjit.so" >> ./fg42-wm @echo 'FG42_WM=false emacs --name FG42 --no-site-file --no-site-lisp --no-splash --title FG42 -l $$FG42_HOME/fg42-config.el "$$@"' >> ./fg42 @echo 'FG42_WM=true emacs --name FG42 --no-site-file --no-site-lisp --no-splash --title FG42 -l $$FG42_HOME/fg42-config.el "$$@"' >> ./fg42-wm @chmod +x ./fg42 @@ -67,9 +70,17 @@ clean: dev-docs: clean ./build.el docs +.PHONY: docs +docs: + FG42_PROD=true ./build.el docs + serve: build npx http-server ./build +.PHONY: deploy-docs +deploy-docs: docs + rsync -vlcr --delete-after ./build/* core.lxsameer.com:/home/www/public/fg42/ + .PHONY: dummy-x dummy-x: Xephyr -br -ac -noreset -screen 800x600 :1 diff --git a/config/fg42.user.v3.el b/config/fg42.user.v3.el index 047ebe1..f3f9f5d 100644 --- a/config/fg42.user.v3.el +++ b/config/fg42.user.v3.el @@ -39,6 +39,7 @@ (require 'cubes/org) (require 'cubes/git) (require 'cubes/bookmark) +(require 'cubes/terraform) ;; ============== MY STUFF ============================== (custom-set-faces @@ -48,10 +49,10 @@ (t :background "#bd93f9" :height 0.1 :box nil)))) -(defvar global-font-size 10) +(defvar global-font-size 14) -(setq lsp-clients-clangd-executable "~/usr/lib/llvm-13/bin/clangd") +(setq lsp-clients-clangd-executable "/home/lxsameer/usr/lib/llvm-13rc2/bin/clangd") (defconst LLVM_DIR "/home/lxsameer/src/serene/llvm-project") (defconst llvm-config-dir (concat LLVM_DIR "/llvm/utils/emacs/")) @@ -114,6 +115,7 @@ (fg42/font-cube :font-size global-font-size) (fg42/editor-cube) +;;(fg42/imenu-cube) (fg42/elisp-cube) (fg42/region-expansion-cube) @@ -131,6 +133,7 @@ (fg42/vterm-cube) (fg42/git-cube) (fg42/bookmark-cube) +(fg42/terraform-cube :terraform-lsp-path "~/bin/terraform-lsp") (fg42/java-cube) (fg42/yasnippet-cube) ;; Themes should be the last cube and anything that wants to manipulate a face diff --git a/core/cubes/editor.el b/core/cubes/editor.el index f9f6a98..29b14ef 100644 --- a/core/cubes/editor.el +++ b/core/cubes/editor.el @@ -43,6 +43,14 @@ (setq epa-pinentry-mode 'loopback) (pinentry-start)))) +(defcube fg42/imenu-cube + (:docs "cubes/fg42/imenu-cube.org" + :flag imenu + :flag-default t) + (fpkg/use imenu-list + :init + (global-set-key (kbd "C-'") #'imenu-list-smart-toggle))) + (defcube fg42/exec-path-cube (:docs "cubes/fg42/exec-path-cube.org" @@ -54,6 +62,14 @@ (exec-path-from-shell-initialize)))) +(defcube fg42/hl-cube + (:docs "cubes/fg42/hl-path-cube.org" + :flag hl-line + :flag-default t) + (require 'hl-line) + (global-hl-line-mode)) + + (defcube fg42/cursor-cube (:docs "cubes/fg42/cursor-cube.org" :flag cursor-type @@ -209,7 +225,8 @@ (fg42/buffer-navigation-cube) (fg42/window-navigation-cube) (fg42/selectrum-cube) - (fg42/cursor-cube)) + (fg42/cursor-cube) + (fg42/hl-cube)) (provide 'cubes/editor) diff --git a/core/cubes/git.el b/core/cubes/git.el index 126fdee..cc32e94 100644 --- a/core/cubes/git.el +++ b/core/cubes/git.el @@ -1,4 +1,4 @@ -;;; OrgCube --- The elisp cube for FG42 -*- lexical-binding: t; -*- +;;; GitCube --- The Git cube for FG42 -*- lexical-binding: t; -*- ;; ;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors ;; @@ -34,7 +34,6 @@ :flag git :flag-default t) - (fpkg/use magit :bind (("C-x g" . magit-status))) diff --git a/core/cubes/org.el b/core/cubes/org.el index d235194..628217d 100644 --- a/core/cubes/org.el +++ b/core/cubes/org.el @@ -1,4 +1,4 @@ -;;; OrgCube --- The elisp cube for FG42 -*- lexical-binding: t; -*- +;;; OrgCube --- The org cube for FG42 -*- lexical-binding: t; -*- ;; ;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors ;; @@ -49,15 +49,17 @@ (setq org-directory org-home) (setq org-default-notes-file notes-file) (setq org-capture-templates - '(("t" "Todo" entry (file+headline (expand-file-name "main.org" org-home) "New Tasks") - (file (expand-file-name "templates/todo" org-home)) - :prepend t) - ("l" "Link" entry (file+headline (expand-file-name "bookmarks.org" org-home) "Links") - (file (expand-file-name "templates/links" org-home)) - :prepend t - :empty-lines 1) - ("h" "Thoughts" entry (file+datetree (expand-file-name "journal.org" org-home)) - (file (expand-file-name "templates/thoughts" org-home))))) + (eval + `(list + '("t" "Todo" entry (file+headline ,(expand-file-name "main.org" org-home) "New Tasks") + (file ,(expand-file-name "templates/todo" org-home)) + :prepend t) + '("l" "Link" entry (file+headline ,(expand-file-name "bookmarks.org" org-home) "Links") + (file ,(expand-file-name "templates/links" org-home)) + :prepend t + :empty-lines 1) + '("h" "Thoughts" entry (file+datetree ,(expand-file-name "journal.org" org-home)) + (file ,(expand-file-name "templates/thoughts" org-home)))))) (setq org-refile-targets '((org-agenda-files :maxlevel . 3))) (with-eval-after-load "ox-latex" @@ -68,5 +70,6 @@ (unless (server-running-p) (require 'org-protocol)))))) + (provide 'cubes/org) ;;; org.el ends here diff --git a/core/cubes/terraform.el b/core/cubes/terraform.el new file mode 100644 index 0000000..adb94fe --- /dev/null +++ b/core/cubes/terraform.el @@ -0,0 +1,56 @@ +;;; Terraform --- The terraform cube for FG42 -*- lexical-binding: t; -*- +;; +;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors +;; +;; Author: Sameer Rahmani +;; URL: https://gitlab.com/FG42/FG42 +;; Version: 3.0.0 +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . +;; +;;; Commentary: +;; Cubes are the building blocks of any `FG42' editor. Each `cube' is a +;; unit which defines different abilities in a deterministic and idempotent +;; way. Cubes are composable and a composition of cubes creates an editor. +;; +;;; Code: +(require 'fpkg) +(require 'fg42/cube) + + +(defcube fg42/terraform-cube + (:docs "cubes/fg42/terraform-cube.org" + :flag terraform + :flag-default t) + + ;; https://github.com/juliosueiras/terraform-lsp is required + (let ((terraform-lsp (or (plist-get fg42/terraform-cube-params :terraform-lsp-path) "terraform-lsp")) + (lsp-flags (or (plist-get fg42/terraform-cube-params :terraform-lsp-flags) "-enable-log-file"))) + (fpkg/use terraform-mode + :config + (progn + (when-flag lsp + (require 'lsp) + (add-to-list 'lsp-language-id-configuration '(terraform-mode . "terraform")) + + (lsp-register-client + (make-lsp-client :new-connection (lsp-stdio-connection (list terraform-lsp lsp-flags)) + :major-modes '(terraform-mode) + :server-id 'terraform-ls)) + + (add-hook 'terraform-mode-hook #'lsp)))))) + + +(provide 'cubes/terraform) +;;; terraform.el ends here diff --git a/dev.org b/dev.org index f6e7d7d..8a13898 100644 --- a/dev.org +++ b/dev.org @@ -48,6 +48,7 @@ On the first level, I should feel comfortable with it. (package-install 'exec-path-from-shell) (exec-path-from-shell-initialize) #+END_SRC +** TODO Integrate window-purpose mode ** TODO Turn on yasnippet mode for Go mode * Things that didn't work out - rbenv diff --git a/fg42-config.el b/fg42-config.el index 71c80b3..31c57ed 100644 --- a/fg42-config.el +++ b/fg42-config.el @@ -21,7 +21,7 @@ ;; ;;; Commentary: ;;; Code: - +(setq debug-on-error t) (defvar fg42-v3 (string= (or (getenv "FG42_V3") "false") "true"))