Merge branch 'emacs29'

This commit is contained in:
Tom Alexander 2023-08-27 14:04:37 -04:00
commit d0ba7ac54b
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
35 changed files with 361 additions and 196 deletions

View File

@ -1,2 +1,3 @@
timezone: "America/New_York" timezone: "America/New_York"
install_bluetooth: true install_bluetooth: true
emacs_flavor: "full"

View File

@ -0,0 +1 @@
emacs_flavor: "plain" # or full for systems where I do real development.

View File

@ -64,9 +64,10 @@
(setq tramp-default-method "ssh") (setq tramp-default-method "ssh")
(use-package dockerfile-mode)
(use-package nginx-mode (use-package nginx-mode
:mode (
("headers\\.include\\'" . nginx-mode)
)
:config :config
(setq nginx-indent-level 4)) (setq nginx-indent-level 4))

View File

@ -1,14 +1,10 @@
(package-initialize) (package-initialize)
(use-package use-package)
(add-to-list 'package-archives (add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") '("melpa" . "https://melpa.org/packages/")
) )
(when (not package-archive-contents)
(package-refresh-contents))
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(use-package auto-package-update (use-package auto-package-update
:ensure t :ensure t
:config :config
@ -32,6 +28,7 @@
require-final-newline t require-final-newline t
visible-bell nil visible-bell nil
ring-bell-function 'ignore ring-bell-function 'ignore
;; Write custom variables to an unused file so in-editor changes do not persist.
custom-file "~/.emacs.d/.custom.el" custom-file "~/.emacs.d/.custom.el"
;; http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html ;; http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
minibuffer-prompt-properties minibuffer-prompt-properties
@ -59,6 +56,8 @@
use-short-answers t use-short-answers t
package-native-compile t package-native-compile t
delete-selection-mode t delete-selection-mode t
;; Don't show warnings when compiling elisp to native binaries.
native-comp-async-report-warnings-errors 'silent
) )
(defun assert-directory (p) (defun assert-directory (p)
@ -69,8 +68,6 @@
(setq autoload-directory (concat user-emacs-directory (file-name-as-directory "elisp") (file-name-as-directory "autoload"))) (setq autoload-directory (concat user-emacs-directory (file-name-as-directory "elisp") (file-name-as-directory "autoload")))
(add-to-list 'load-path (assert-directory autoload-directory)) (add-to-list 'load-path (assert-directory autoload-directory))
;; Bookmarks ;; Bookmarks
(setq (setq
;; persistent bookmarks ;; persistent bookmarks

View File

@ -1,4 +1,5 @@
(use-package eglot (use-package eglot
:pin gnu
:commands (eglot eglot-ensure) :commands (eglot eglot-ensure)
:bind (:map eglot-mode-map :bind (:map eglot-mode-map
;; M-. ;; M-.

View File

@ -28,6 +28,6 @@
(require 'lang-go) (require 'lang-go)
(require 'lang-c) (require 'lang-dockerfile)
(load-directory autoload-directory) (load-directory autoload-directory)

View File

@ -1,12 +1,12 @@
(require 'common-lsp)
(require 'util-tree-sitter) (require 'util-tree-sitter)
(use-package sh-mode (use-package bash-ts-mode
:ensure nil :ensure nil
:commands sh-mode :commands bash-ts-mode
:hook ((sh-mode . flycheck-mode) :init
(sh-mode . tree-sitter-hl-mode) (add-to-list 'major-mode-remap-alist '(sh-mode . bash-ts-mode))
) (add-to-list 'treesit-language-source-alist '(bash "https://github.com/tree-sitter/tree-sitter-bash"))
(unless (treesit-ready-p 'bash) (treesit-install-language-grammar 'bash))
) )
(provide 'lang-bash) (provide 'lang-bash)

View File

@ -1,32 +0,0 @@
(require 'common-lsp)
(require 'util-tree-sitter)
;; To generate a compilation database for the language server, run:
;; intercept-build13 --append make
;;
;; Output: compile_commands.json
(defun use-clangd ()
"Configure eglot to use clangd."
(eglot-ensure)
(defclass my/eglot-c (eglot-lsp-server) ()
:documentation
"Own eglot server class.")
(add-to-list 'eglot-server-programs
'(cc-mode . (my/eglot-c "clangd13")))
(tree-sitter-hl-mode)
)
(use-package cc-mode
;; c-mode c++-mode objc-mode java-mode idl-mode pike-mode awk-mode
:commands (c-mode c++-mode)
:pin manual
:hook (
(c-mode . use-clangd)
(c++-mode . use-clangd)
)
)
(provide 'lang-c)

View File

@ -0,0 +1,13 @@
(use-package dockerfile-ts-mode
:pin manual
:mode (
("Dockerfile\\'" . dockerfile-ts-mode)
)
:commands (dockerfile-mode dockerfile-ts-mode)
:init
(add-to-list 'major-mode-remap-alist '(dockerfile-mode . dockerfile-ts-mode))
(add-to-list 'treesit-language-source-alist '(dockerfile "https://github.com/camdencheek/tree-sitter-dockerfile"))
(unless (treesit-ready-p 'dockerfile) (treesit-install-language-grammar 'dockerfile))
)
(provide 'lang-dockerfile)

View File

@ -1,15 +1,27 @@
(require 'common-lsp) (require 'common-lsp)
(require 'util-tree-sitter) (require 'util-tree-sitter)
(use-package go-mode (use-package go-ts-mode
:commands go-mode :pin manual
:mode (
("\\.go\\'" . go-ts-mode)
("/go\\.mod\\'" . go-ts-mode)
)
:commands (go-mode go-ts-mode)
:hook ( :hook (
(go-mode . (lambda () (go-ts-mode . (lambda ()
(when-linux
(eglot-ensure) (eglot-ensure)
(tree-sitter-hl-mode +1) )
)) ))
;; (before-save . lsp-format-buffer) ;; (before-save . lsp-format-buffer)
) )
:init
(add-to-list 'major-mode-remap-alist '(go-mode . go-ts-mode))
(add-to-list 'treesit-language-source-alist '(go "https://github.com/tree-sitter/tree-sitter-go"))
(add-to-list 'treesit-language-source-alist '(gomod "https://github.com/camdencheek/tree-sitter-go-mod"))
(unless (treesit-ready-p 'go) (treesit-install-language-grammar 'go))
(unless (treesit-ready-p 'gomod) (treesit-install-language-grammar 'gomod))
) )
(provide 'lang-go) (provide 'lang-go)

View File

@ -1,40 +1,21 @@
(require 'common-lsp) (require 'common-lsp)
(require 'util-tree-sitter) (require 'util-tree-sitter)
(use-package js (use-package json-ts-mode
:mode ( :ensure nil
("\\.js\\'" . js-mode)
("\\.json\\'" . js-mode)
)
:commands js-mode
:pin manual :pin manual
:hook (
(find-file . (lambda () (when (string= (file-name-extension buffer-file-name) "json") (add-hook 'before-save-hook 'json-fmt-jq nil 'local))))
(js-mode . (lambda ()
(tree-sitter-hl-mode +1)
)
)
)
:config
(setq js-indent-level 2)
)
(use-package typescript-mode
:mode ( :mode (
("\\.ts\\'" . typescript-mode) ("\\.json\\'" . json-ts-mode)
("\\.tsx\\'" . typescript-mode)
) )
:commands (json-ts-mode)
:hook ( :hook (
(typescript-mode . (lambda () (json-ts-mode . (lambda ()
;; (lsp-register-client (add-hook 'before-save-hook 'json-fmt-jq nil 'local)
;; (make-lsp-client :new-connection (lsp-stdio-connection '("deno" "lsp" --compat --unstable --allow-read))
;; :major-modes '(typescript-mode)
;; :server-id 'typescript-ls))
(eglot-ensure)
(tree-sitter-hl-mode +1)
)) ))
;; (before-save . lsp-format-buffer)
) )
:init
(add-to-list 'treesit-language-source-alist '(json "https://github.com/tree-sitter/tree-sitter-json"))
(unless (treesit-ready-p 'json) (treesit-install-language-grammar 'json))
) )
(defun json-fmt-jq () (defun json-fmt-jq ()
@ -42,20 +23,91 @@
(run-command-on-buffer "jq" "--monochrome-output" ".") (run-command-on-buffer "jq" "--monochrome-output" ".")
) )
(use-package web-mode (use-package tsx-ts-mode
:mode (("\\.dust\\'" . web-mode) :ensure nil
:pin manual
:mode (
("\\.tsx\\'" . tsx-ts-mode)
) )
:config :commands (tsx-ts-mode)
(setq web-mode-markup-indent-offset 2) :hook (
(setq web-mode-enable-current-element-highlight t) (tsx-ts-mode . (lambda ()
(when-linux
(eglot-ensure)
)
))
)
:init
(add-to-list 'treesit-language-source-alist '(tsx . ("https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")))
(unless (treesit-ready-p 'tsx) (treesit-install-language-grammar 'tsx))
) )
;; Define a custom mode for dust so that org-mode handle #+BEGIN_SRC dust blocks
(define-derived-mode dust-mode web-mode "WebDust" (use-package typescript-ts-mode
"Major mode for editing dust templates in web-mode." :ensure nil
(web-mode) :pin manual
(web-mode-set-engine "dust") :mode (
;; (setq web-mode-content-type "html") ("\\.ts\\'" . typescript-ts-mode)
) )
:commands (typescript-ts-mode)
:hook (
(typescript-ts-mode . (lambda ()
(when-linux
(eglot-ensure)
)
))
)
:init
(add-to-list 'treesit-language-source-alist '(typescript . ("https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")))
(unless (treesit-ready-p 'typescript) (treesit-install-language-grammar 'typescript))
)
(use-package js-ts-mode
:ensure nil
:pin manual
:mode (
("\\.js\\'" . js-ts-mode)
)
:commands (js-ts-mode)
:hook (
(js-ts-mode . (lambda ()
(when-linux
(eglot-ensure)
)
))
)
:init
(add-to-list 'treesit-language-source-alist '(javascript . ("https://github.com/tree-sitter/tree-sitter-javascript" "master" "src")))
(unless (treesit-ready-p 'javascript) (treesit-install-language-grammar 'javascript))
)
(use-package css-ts-mode
:ensure nil
:pin manual
:mode (
("\\.css\\'" . css-ts-mode)
)
:commands (css-ts-mode)
:init
(add-to-list 'treesit-language-source-alist '(css "https://github.com/tree-sitter/tree-sitter-css"))
(unless (treesit-ready-p 'css) (treesit-install-language-grammar 'css))
)
;; (use-package web-mode
;; :mode (("\\.dust\\'" . web-mode)
;; )
;; :config
;; (setq web-mode-markup-indent-offset 2)
;; (setq web-mode-enable-current-element-highlight t)
;; )
;; ;; Define a custom mode for dust so that org-mode handle #+BEGIN_SRC dust blocks
;; (define-derived-mode dust-mode web-mode "WebDust"
;; "Major mode for editing dust templates in web-mode."
;; (web-mode)
;; (web-mode-set-engine "dust")
;; ;; (setq web-mode-content-type "html")
;; )
(provide 'lang-javascript) (provide 'lang-javascript)

View File

@ -52,11 +52,11 @@
) )
(use-package python (use-package python
:mode ("\\.py\\'" . python-mode) :mode ("\\.py\\'" . python-ts-mode)
:commands python-mode :commands (python-mode python-ts-mode)
:pin manual :pin manual
:hook ( :hook (
(python-mode . (lambda () (python-ts-mode . (lambda ()
(when (executable-find "poetry") (when (executable-find "poetry")
(add-poetry-venv-to-path) (add-poetry-venv-to-path)
(let ((venv (locate-venv-poetry))) (when venv (let ((venv (locate-venv-poetry))) (when venv
@ -64,14 +64,19 @@
(list (cons ':python (list ':venvPath venv ':pythonPath (concat venv "/bin/python"))))) (list (cons ':python (list ':venvPath venv ':pythonPath (concat venv "/bin/python")))))
)) ))
) )
(when-linux
(eglot-ensure) (eglot-ensure)
)
(add-hook 'before-save-hook 'python-fmt nil 'local) (add-hook 'before-save-hook 'python-fmt nil 'local)
(tree-sitter-hl-mode +1)
)) ))
) )
:bind ((:map python-mode-map ([backspace] . python-backspace)) :bind ((:map python-ts-mode-map ([backspace] . python-backspace))
) )
:init
(add-to-list 'major-mode-remap-alist '(python-mode . python-ts-mode))
(add-to-list 'treesit-language-source-alist '(python "https://github.com/tree-sitter/tree-sitter-python"))
(unless (treesit-ready-p 'python) (treesit-install-language-grammar 'python))
) )
(provide 'lang-python) (provide 'lang-python)

View File

@ -4,8 +4,8 @@
(defun locate-rust-analyzer () (defun locate-rust-analyzer ()
"Find rust-analyzer." "Find rust-analyzer."
(let ((rust-analyzer-paths (list (locate-rust-analyzer-rustup) (locate-rust-analyzer-ansible-built)))) (let ((rust-analyzer-paths (list (locate-rust-analyzer-rustup) (locate-rust-analyzer-ansible-built))))
(let ((first-non-nill-path (seq-find (lambda (elt) elt) rust-analyzer-paths))) (let ((first-non-nil-path (seq-find (lambda (elt) elt) rust-analyzer-paths)))
first-non-nill-path first-non-nil-path
) )
) )
) )
@ -24,26 +24,43 @@
) )
) )
(use-package rust-mode (use-package rust-ts-mode
:mode "\\.rs\\'" :pin manual
:mode (
("\\.rs\\'" . rust-ts-mode)
)
:hook ( :hook (
(rust-mode . (lambda () (rust-ts-mode . (lambda ()
(eglot-ensure) (eglot-ensure)
(let ((rust-analyzer-command (locate-rust-analyzer))) (let ((rust-analyzer-command (locate-rust-analyzer)))
(when rust-analyzer-command (when rust-analyzer-command
(add-to-list 'eglot-server-programs (cons 'rust-mode (list rust-analyzer-command))) (add-to-list 'eglot-server-programs (cons 'rust-ts-mode (list rust-analyzer-command)))
) )
) )
(when-linux
(tree-sitter-hl-mode +1)
)
(add-hook 'before-save-hook 'eglot-format-buffer nil 'local) (add-hook 'before-save-hook 'eglot-format-buffer nil 'local)
)) ))
) )
:init
(add-to-list 'major-mode-remap-alist '(rust-mode . rust-ts-mode))
(add-to-list 'treesit-language-source-alist '(rust "https://github.com/tree-sitter/tree-sitter-rust"))
(unless (treesit-ready-p 'yaml) (treesit-install-language-grammar 'rust))
:config :config
;; Add keybindings for interacting with Cargo ;; Add keybindings for interacting with Cargo
(use-package cargo (use-package cargo
:hook (rust-mode . cargo-minor-mode)) :hook (rust-ts-mode . cargo-minor-mode))
) )
(use-package toml-ts-mode
:ensure nil
:pin manual
:mode (
("\\.toml\\'" . toml-ts-mode)
)
:commands (toml-ts-mode)
:init
(add-to-list 'treesit-language-source-alist '(toml "https://github.com/tree-sitter/tree-sitter-toml"))
(unless (treesit-ready-p 'toml) (treesit-install-language-grammar 'toml))
)
(provide 'lang-rust) (provide 'lang-rust)

View File

@ -13,7 +13,6 @@
:custom (hcl-indent-level 2) :custom (hcl-indent-level 2)
:hook ( :hook (
(hcl-mode . (lambda () (unless (derived-mode-p 'terraform-mode) (add-hook 'before-save-hook 'terraform-fmt nil 'local)))) (hcl-mode . (lambda () (unless (derived-mode-p 'terraform-mode) (add-hook 'before-save-hook 'terraform-fmt nil 'local))))
(hcl-mode . tree-sitter-hl-mode)
) )
) )

View File

@ -1,35 +1,26 @@
(defun yaml-backspace (arg)
"Special handling of yaml backspace."
(interactive "*p")
(if mark-active
(backward-delete-char-untabify arg)
(yaml-electric-backspace arg)
)
)
(defun yaml-format-buffer () (defun yaml-format-buffer ()
"Run prettier." "Run prettier."
(interactive) (interactive)
(run-command-on-buffer "prettier" "--stdin-filepath" buffer-file-name) (run-command-on-buffer "prettier" "--stdin-filepath" buffer-file-name)
) )
(use-package yaml-mode (use-package yaml-ts-mode
:mode :mode
(("playbook\\.tmp\\'" . yaml-mode) (
("environments/[^/]*/group_vars/[^/]*\\'" . yaml-mode) ("\\.y[a]?ml\\'" . yaml-ts-mode)
("environments/[^/]*/host_vars/[^/]*\\'" . yaml-mode) ("playbook\\.tmp\\'" . yaml-ts-mode)
("environments/[^/]*/group_vars/[^/]*\\'" . yaml-ts-mode)
("environments/[^/]*/host_vars/[^/]*\\'" . yaml-ts-mode)
) )
:hook ( :hook (
(yaml-mode . (lambda () (yaml-ts-mode . (lambda ()
(setq eglot-workspace-configuration
(list (cons ':yaml (list ':hover :json-false :validate :json-false :completion t))))
(eglot-ensure)
(add-hook 'before-save-hook 'yaml-format-buffer nil 'local) (add-hook 'before-save-hook 'yaml-format-buffer nil 'local)
)) ))
) )
:bind ( :init
(:map yaml-mode-map ([backspace] . yaml-backspace)) (add-to-list 'major-mode-remap-alist '(yaml-mode . yaml-ts-mode))
) (add-to-list 'treesit-language-source-alist '(yaml "https://github.com/ikatyang/tree-sitter-yaml"))
(unless (treesit-ready-p 'yaml) (treesit-install-language-grammar 'yaml))
) )
(provide 'lang-yaml) (provide 'lang-yaml)

View File

@ -0,0 +1,12 @@
[Desktop Entry]
Name=Plainmacs
GenericName=Text Editor
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=plainmacs %F
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupNotify=true
StartupWMClass=Emacs

View File

@ -0,0 +1,19 @@
(progn
(setq make-backup-files nil auto-save-default nil create-lockfiles nil)
(load-theme 'tango-dark t)
(set-face-attribute 'default nil :background "black")
;; Bright yellow highlighting for selected region
(set-face-attribute 'region nil :background "#ffff50" :foreground "black")
;; Bright green cursor to distinguish from yellow region
(set-cursor-color "#ccff66")
;; Hightlight the current line
(set-face-attribute 'line-number-current-line nil :foreground "white")
;; Set default font
(set-face-attribute 'default nil :height 100 :width 'regular :weight 'regular :family "Cascadia Mono")
;; Set fallback font for unicode glyphs
(set-fontset-font "fontset-default" nil (font-spec :name "Noto Color Emoji"))
(menu-bar-mode -1)
(when (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
(when ( fboundp 'scroll-bar-mode)
(scroll-bar-mode -1)))

View File

@ -1,7 +1,16 @@
(use-package tree-sitter (use-package treesit
:commands (tree-sitter-hl-mode) :pin manual
:ensure nil
:commands (treesit-install-language-grammar treesit-ready-p)
:init
(setq treesit-language-source-alist '())
:config :config
(use-package tree-sitter-langs) ;; Default to the max level of detail in treesitter highlighting. This
;; can be overridden in each language's use-package call with:
;;
;; :custom
;; (treesit-font-lock-level 3)
(setq treesit-font-lock-level 4)
) )
(provide 'util-tree-sitter) (provide 'util-tree-sitter)

View File

@ -1,5 +1,5 @@
dependencies: dependencies:
- users - users
- fonts - fonts
- rust - role: rust
- plainmacs when: 'emacs_flavor == "full"'

View File

@ -1,9 +1,21 @@
- name: Install packages - name: Install packages
when: 'emacs_flavor == "full"'
package: package:
name: name:
- aspell - aspell
state: present state: present
- name: Install scripts
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0755
owner: root
group: wheel
loop:
- src: plainmacs
dest: /usr/local/bin/plainmacs
- import_tasks: tasks/freebsd.yaml - import_tasks: tasks/freebsd.yaml
when: 'os_flavor == "freebsd"' when: 'os_flavor == "freebsd"'

View File

@ -2,6 +2,12 @@
package: package:
name: name:
- emacs - emacs
state: present
- name: Install packages
when: 'emacs_flavor == "full"'
package:
name:
- py39-pygments - py39-pygments
- inkscape # to support SVGs in LaTeX - inkscape # to support SVGs in LaTeX
# - prettier # typescript formatting # - prettier # typescript formatting

View File

@ -2,4 +2,38 @@
package: package:
name: name:
- aspell-en - aspell-en
- emacs
state: present state: present
- name: Install packages
when: 'emacs_flavor == "full"'
package:
name:
- prettier # typescript+yaml formatting
- pyright
- gopls
- typescript-language-server
state: present
- name: Create directories
file:
name: "{{ item }}"
state: directory
mode: 0755
owner: root
group: root # Using root group to match /usr/share/applications
loop:
- /usr/local/share/applications
- name: Install Configuration
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0644
owner: root
group: wheel
# Can't use validate because it complains about the file extension for the temporary file.
# validate: "desktop-file-validate %s"
loop:
- src: plainmacs.desktop
dest: /usr/local/share/applications/

View File

@ -12,6 +12,7 @@
- ".emacs.d/elisp" - ".emacs.d/elisp"
- name: Configure dotfiles - name: Configure dotfiles
when: 'emacs_flavor == "full"'
copy: copy:
src: "files/{{ item.src }}" src: "files/{{ item.src }}"
dest: "{{ account_homedir.stdout }}/{{ item.dest }}" dest: "{{ account_homedir.stdout }}/{{ item.dest }}"
@ -22,7 +23,20 @@
- src: init.el - src: init.el
dest: .emacs.d/init.el dest: .emacs.d/init.el
- name: Configure dotfiles
when: 'emacs_flavor == "plain"'
copy:
src: "files/{{ item.src }}"
dest: "{{ account_homedir.stdout }}/{{ item.dest }}"
mode: 0600
owner: "{{ account_name.stdout }}"
group: "{{ group_name.stdout }}"
loop:
- src: plainmacs_init.el
dest: .emacs.d/init.el
- name: Configure elisp files - name: Configure elisp files
when: 'emacs_flavor == "full"'
copy: copy:
src: "files/{{ item }}" src: "files/{{ item }}"
dest: "{{ account_homedir.stdout }}/.emacs.d/elisp/{{ item }}" dest: "{{ account_homedir.stdout }}/.emacs.d/elisp/{{ item }}"
@ -37,7 +51,7 @@
- base.el - base.el
- common-lsp.el - common-lsp.el
- lang-bash.el - lang-bash.el
- lang-c.el - lang-dockerfile.el
- lang-go.el - lang-go.el
- lang-javascript.el - lang-javascript.el
- lang-lua.el - lang-lua.el
@ -58,7 +72,8 @@
owner: "{{ account_name.stdout }}" owner: "{{ account_name.stdout }}"
group: "{{ group_name.stdout }}" group: "{{ group_name.stdout }}"
loop: loop:
- emacs_e - emacs_e # Create an alias 'e' which launches emacs
- plainmacs # Set the EDITOR to plainmacs
- import_tasks: tasks/peruser_freebsd.yaml - import_tasks: tasks/peruser_freebsd.yaml
when: 'os_flavor == "freebsd"' when: 'os_flavor == "freebsd"'

View File

@ -1,25 +0,0 @@
- name: Install scripts
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0755
owner: root
group: wheel
loop:
- src: plainmacs
dest: /usr/local/bin/plainmacs
- import_tasks: tasks/freebsd.yaml
when: 'os_flavor == "freebsd"'
- import_tasks: tasks/linux.yaml
when: 'os_flavor == "linux"'
- include_tasks:
file: tasks/peruser.yaml
apply:
become: yes
become_user: "{{ initialize_user }}"
loop: "{{ users | dict2items | community.general.json_query('[?value.initialize==`true`].key') }}"
loop_control:
loop_var: initialize_user

View File

@ -1,5 +0,0 @@
- name: Install packages
package:
name:
- emacs
state: present

View File

@ -1,5 +0,0 @@
- name: Install packages
package:
name:
- emacs-nativecomp
state: present

View File

@ -1 +0,0 @@
- import_tasks: tasks/common.yaml

View File

@ -1,18 +0,0 @@
- include_role:
name: per_user
- name: Configure zshrc additional imports
copy:
src: "files/zshrc_{{ item }}"
dest: "{{ account_homedir.stdout }}/.config/ansible_deploy/zshrc/{{ item }}.zsh"
mode: 0600
owner: "{{ account_name.stdout }}"
group: "{{ group_name.stdout }}"
loop:
- plainmacs
- import_tasks: tasks/peruser_freebsd.yaml
when: 'os_flavor == "freebsd"'
- import_tasks: tasks/peruser_linux.yaml
when: 'os_flavor == "linux"'

View File

@ -0,0 +1,44 @@
# This file is auto-generated by 'make config'.
# Options for emacs-29.1,3
_OPTIONS_READ=emacs-29.1,3
_FILE_COMPLETE_OPTIONS_LIST=ACL DBUS GNUTLS GSETTINGS HARFBUZZ JSON LCMS2 M17N MAILUTILS MODULES NATIVECOMP OTF PGTK SCROLLBARS SOURCES SQLITE3 THREADS TREESITTER XFT XIM XML XWIDGETS GFILE KQUEUE ALSA OSS GTK2 GTK3 MOTIF XAW XAW3D CAIRO GIF JPEG MAGICK PNG SVG TIFF WEBP XPM
OPTIONS_FILE_SET+=ACL
OPTIONS_FILE_SET+=DBUS
OPTIONS_FILE_SET+=GNUTLS
OPTIONS_FILE_SET+=GSETTINGS
OPTIONS_FILE_SET+=HARFBUZZ
OPTIONS_FILE_SET+=JSON
OPTIONS_FILE_SET+=LCMS2
OPTIONS_FILE_UNSET+=M17N
OPTIONS_FILE_SET+=MAILUTILS
OPTIONS_FILE_SET+=MODULES
OPTIONS_FILE_SET+=NATIVECOMP
OPTIONS_FILE_SET+=OTF
OPTIONS_FILE_SET+=PGTK
OPTIONS_FILE_SET+=SCROLLBARS
OPTIONS_FILE_SET+=SOURCES
OPTIONS_FILE_SET+=SQLITE3
OPTIONS_FILE_SET+=THREADS
OPTIONS_FILE_SET+=TREESITTER
OPTIONS_FILE_UNSET+=XFT
OPTIONS_FILE_UNSET+=XIM
OPTIONS_FILE_SET+=XML
OPTIONS_FILE_UNSET+=XWIDGETS
OPTIONS_FILE_UNSET+=GFILE
OPTIONS_FILE_SET+=KQUEUE
OPTIONS_FILE_UNSET+=ALSA
OPTIONS_FILE_SET+=OSS
OPTIONS_FILE_UNSET+=GTK2
OPTIONS_FILE_SET+=GTK3
OPTIONS_FILE_UNSET+=MOTIF
OPTIONS_FILE_UNSET+=XAW
OPTIONS_FILE_UNSET+=XAW3D
OPTIONS_FILE_SET+=CAIRO
OPTIONS_FILE_SET+=GIF
OPTIONS_FILE_SET+=JPEG
OPTIONS_FILE_UNSET+=MAGICK
OPTIONS_FILE_SET+=PNG
OPTIONS_FILE_SET+=SVG
OPTIONS_FILE_SET+=TIFF
OPTIONS_FILE_SET+=WEBP
OPTIONS_FILE_UNSET+=XPM

View File

@ -4,4 +4,5 @@
- rustup - rustup
- lldb # for lldb-vscode - lldb # for lldb-vscode
- musl # for building static binaries - musl # for building static binaries
- rust-analyzer
state: present state: present

View File

@ -9,15 +9,24 @@ SLEEP_INTERVAL=${SLEEP_INTERVAL:-30}
while true; do while true; do
# TODO: Why not vm.stats.vm.v_page_size ? Are these the same? # TODO: Why not vm.stats.vm.v_page_size ? Are these the same?
page_size=$(sysctl -n hw.pagesize)
free_pages=$(sysctl -n vm.stats.vm.v_free_count)
free_bytes=$((page_size * free_pages))
total_pages=$(sysctl -n vm.stats.vm.v_page_count) total_pages=$(sysctl -n vm.stats.vm.v_page_count)
page_size=$(sysctl -n hw.pagesize)
active=$(sysctl -n vm.stats.vm.v_active_count)
inactive=$(sysctl -n vm.stats.vm.v_inactive_count)
in_use_pages=$((active + inactive))
free_pages=$((total_pages - in_use_pages))
free_bytes=$((page_size * free_pages))
free_percent=$((100 * free_pages / total_pages)) free_percent=$((100 * free_pages / total_pages))
text="" text=""
if [ $free_bytes -ge $((1024 * 1024 * 1024)) ]; then if [ $free_bytes -ge $((1024 * 1024 * 1024)) ]; then
text="$((free_bytes / 1024 / 1024 / 1024)) GiB" text="$((free_bytes / 1024 / 1024 / 1024)) GiB"
elif [ $free_bytes -ge $((1024 * 1024)) ]; then
text="$((free_bytes / 1024 / 1024)) MiB"
elif [ $free_bytes -ge 1024 ]; then
text="$((free_bytes / 1024)) KiB"
else
text="$(free_bytes) B"
fi fi
tooltip="${free_percent}%" tooltip="${free_percent}%"