From 4058ea89d9c6a82ec0dac504e7205cbf22c9ceb3 Mon Sep 17 00:00:00 2001 From: John Turner Date: Sun, 16 Jul 2023 00:45:01 -0400 Subject: [PATCH] converted init code to use use-package --- early-init.el | 49 +------ init.el | 123 ++++++++++-------- init/company/init-company.el | 8 -- init/compile/init-compile.el | 3 - init/conf-mode/init-conf-mode-hooks.el | 1 - init/conf-mode/init-conf-mode.el | 5 - init/dired/init-dired.el | 4 - .../init-display-buffer-best-side.el | 7 - init/display-buffer/init-display-buffer.el | 5 - init/ediff/init-ediff.el | 4 - init/eglot/init-eglot.el | 4 - init/eldoc/init-eldoc.el | 4 - init/electric/init-electric.el | 7 - .../init-flycheck-cargo-has-command-p-fix.el | 7 - init/flycheck/init-flycheck.el | 15 --- init/flymake/init-flymake-hooks.el | 2 - init/flymake/init-flymake.el | 12 -- .../init-garbage-collection.el | 3 - init/ibuffer/init-ibuffer-filter-groups.el | 10 -- .../init-ibuffer-human-readable-size.el | 16 --- init/ibuffer/init-ibuffer-never-show.el | 11 -- init/ibuffer/init-ibuffer.el | 21 --- init/ielm/init-ielm.el | 3 - init/keys/init-keys.el | 12 -- .../init-lsp-mode-disable-install-server.el | 40 ------ init/lsp-mode/init-lsp-mode.el | 19 --- init/man/init-man.el | 3 - init/mode-line/init-mode-line.el | 16 --- init/native-comp/init-native-comp.el | 4 - init/package/init-package.el | 4 - init/pixel-scroll/init-pixel-scroll.el | 10 -- init/prog-mode/init-prog-mode-hooks.el | 1 - init/prog-mode/init-prog-mode.el | 5 - .../init-project-find-rust-projects.el | 4 - init/project/init-project.el | 3 - init/recentf/init-recentf.el | 6 - init/savehist/init-savehist.el | 15 --- init/text-mode/init-text-mode-hooks.el | 9 -- init/text-mode/init-text-mode.el | 3 - .../tramp/init-tramp-connection-properties.el | 2 - init/tramp/init-tramp-sudo-hang-fix.el | 3 - init/tramp/init-tramp.el | 10 -- .../init-treesit-setup-available-languages.el | 97 -------------- init/treesit/init-treesit.el | 3 - lisp/packages.el | 27 ++++ 45 files changed, 98 insertions(+), 522 deletions(-) delete mode 100644 init/company/init-company.el delete mode 100644 init/compile/init-compile.el delete mode 100644 init/conf-mode/init-conf-mode-hooks.el delete mode 100644 init/conf-mode/init-conf-mode.el delete mode 100644 init/dired/init-dired.el delete mode 100644 init/display-buffer/init-display-buffer-best-side.el delete mode 100644 init/display-buffer/init-display-buffer.el delete mode 100644 init/ediff/init-ediff.el delete mode 100644 init/eglot/init-eglot.el delete mode 100644 init/eldoc/init-eldoc.el delete mode 100644 init/electric/init-electric.el delete mode 100644 init/flycheck/init-flycheck-cargo-has-command-p-fix.el delete mode 100644 init/flycheck/init-flycheck.el delete mode 100644 init/flymake/init-flymake-hooks.el delete mode 100644 init/flymake/init-flymake.el delete mode 100644 init/garbage-collection/init-garbage-collection.el delete mode 100644 init/ibuffer/init-ibuffer-filter-groups.el delete mode 100644 init/ibuffer/init-ibuffer-human-readable-size.el delete mode 100644 init/ibuffer/init-ibuffer-never-show.el delete mode 100644 init/ibuffer/init-ibuffer.el delete mode 100644 init/ielm/init-ielm.el delete mode 100644 init/keys/init-keys.el delete mode 100644 init/lsp-mode/init-lsp-mode-disable-install-server.el delete mode 100644 init/lsp-mode/init-lsp-mode.el delete mode 100644 init/man/init-man.el delete mode 100644 init/mode-line/init-mode-line.el delete mode 100644 init/native-comp/init-native-comp.el delete mode 100644 init/package/init-package.el delete mode 100644 init/pixel-scroll/init-pixel-scroll.el delete mode 100644 init/prog-mode/init-prog-mode-hooks.el delete mode 100644 init/prog-mode/init-prog-mode.el delete mode 100644 init/project/init-project-find-rust-projects.el delete mode 100644 init/project/init-project.el delete mode 100644 init/recentf/init-recentf.el delete mode 100644 init/savehist/init-savehist.el delete mode 100644 init/text-mode/init-text-mode-hooks.el delete mode 100644 init/text-mode/init-text-mode.el delete mode 100644 init/tramp/init-tramp-connection-properties.el delete mode 100644 init/tramp/init-tramp-sudo-hang-fix.el delete mode 100644 init/tramp/init-tramp.el delete mode 100644 init/treesit/init-treesit-setup-available-languages.el delete mode 100644 init/treesit/init-treesit.el create mode 100644 lisp/packages.el diff --git a/early-init.el b/early-init.el index 683dbd9..da48e00 100644 --- a/early-init.el +++ b/early-init.el @@ -1,47 +1,2 @@ -(setq auth-source-save-behavior nil - auto-save-default nil - change-major-mode-with-file-name nil - custom-buffer-indent 4 - custom-file (file-name-concat user-emacs-directory "custom.el") - custom-theme-directory (file-name-concat user-emacs-directory "themes/") - debugger 'edebug - initial-buffer-choice (lambda () - (let ((initial-file (file-name-concat - user-emacs-directory - "initial-buffer"))) - (if (file-exists-p initial-file) - (find-file initial-file) - (get-buffer-create "*scratch*")))) - enable-local-variables :safe - inferior-lisp-program "sbcl" - inhibit-splash-screen t - make-backup-files nil - scheme-program-name "guile" - tab-width 4 - temporary-file-directory (file-name-concat (getenv "HOME") "tmp" ".emacs")) - -(setq-default display-fill-column-indicator-column 120 - indent-tabs-mode nil) - -(let* ((init-modules-wildcard - (file-name-concat user-emacs-directory "init" "*")) - (lisp-modules-wildcard - (file-name-concat user-emacs-directory "lisp" "*")) - (init-modules-files - (file-expand-wildcards init-modules-wildcard t)) - (lisp-modules-files - (file-expand-wildcards lisp-modules-wildcard t)) - (files - (append init-modules-files lisp-modules-files)) - (directories - (seq-filter 'file-directory-p files))) - (mapc (lambda (directory) - (add-to-list 'load-path directory)) - directories)) - -(mkdir temporary-file-directory t) - -(require 'init-garbage-collection) - -(when (and (>= emacs-major-version 29) (native-comp-available-p)) - (require 'init-native-comp)) +(setq native-comp-async-jobs-number (string-to-number (shell-command-to-string "nproc")) + native-compile-target-directory (file-name-concat (getenv "HOME") ".cache/emacs-native-comp")) diff --git a/init.el b/init.el index ca60d03..bda82da 100644 --- a/init.el +++ b/init.el @@ -1,65 +1,80 @@ -(defmacro require? (feature) - `(require ,feature nil t)) +(require 'use-package) +(require 'cl-lib) +(require 'seq) +(require 'server) +(require 'edebug) + +(global-unset-key (kbd "")) +(global-unset-key (kbd "")) +(global-unset-key (kbd "")) +(global-unset-key (kbd "")) +(global-unset-key (kbd "")) +(global-unset-key (kbd "")) +(global-unset-key (kbd "")) +(global-unset-key (kbd "")) +(global-set-key (kbd "C-x k") 'kill-this-buffer) +(global-set-key (kbd "C-x C-b") 'ibuffer) + +(setq auth-source-save-behavior nil + auto-save-default nil + change-major-mode-with-file-name nil + custom-buffer-indent 4 + custom-file (file-name-concat user-emacs-directory "custom.el") + custom-theme-directory (file-name-concat user-emacs-directory "themes/") + debugger 'edebug + display-buffer-base-action '(display-buffer-same-window display-buffer-reuse-window) + initial-buffer-choice (lambda () + (let ((initial-file (file-name-concat + user-emacs-directory + "initial-buffer"))) + (if (file-exists-p initial-file) + (find-file initial-file) + (get-buffer-create "*scratch*")))) + enable-local-variables :safe + inhibit-splash-screen t + make-backup-files nil + mouse-wheel-progressive-speed nil + tab-width 4 + temporary-file-directory (file-name-concat (or (getenv "TMPDIR") "/tmp") ".emacs") + use-package-always-demand t + use-package-ensure-function 'ignore) + +(setq-default display-fill-column-indicator-column 120 + indent-tabs-mode nil) + +(setq-default mode-line-format '("%*" + " " + (:eval (if buffer-file-name + (abbreviate-file-name buffer-file-name) + (buffer-name))) + " " + "(" mode-name ")" + " " + "(" (:eval (if server-process + (process-name server-process) + "_")) + ")")) -(unless (when-let ((e (getenv "NO_SITE_GENTOO"))) - (string= e "1")) - (require? 'site-gentoo)) - -(require? 'magit) - -(require 'init-text-mode) -(require 'init-conf-mode) -(require 'init-prog-mode) -(require 'init-compile) -(require 'init-dired) -(require 'init-display-buffer) -(require 'init-ediff) -(require 'init-eldoc) -(require 'init-electric) -(require 'init-flymake) -(require 'init-ibuffer) -(require 'init-ielm) -(require 'init-keys) -(require 'init-man) -(require 'init-mode-line) -(require 'init-package) -(require 'init-project) -(require 'init-recentf) -(require 'init-savehist) -(require 'init-tramp) - -(when (require? 'company) - (require 'init-company)) - -(when (require? 'flycheck) - (require 'init-flycheck)) - -(when (require? 'lsp-mode) - (require 'init-lsp-mode)) - -(when (require? 'eglot) - (require 'init-eglot)) - -(when (require? 'pixel-scroll) - (require 'init-pixel-scroll)) - -(when (and (require? 'treesit) (treesit-available-p)) - (require 'init-treesit)) - -(require 'man-completion) - -(require 'license-boilerplate) +(when (file-exists-p custom-file) + (load-file custom-file)) -(require 'toggle-local-vars) +(load-file (locate-user-emacs-file "lisp/packages.el")) -(require 'reload-library) +(cl-loop with packages-directory = (file-name-concat user-emacs-directory "packages") + for package in (directory-files packages-directory t) + unless (seq-contains-p '("." "..") (file-name-base package)) + do (load-file package)) -(when (file-exists-p custom-file) - (load custom-file)) +(mkdir temporary-file-directory t) (cua-mode 1) (save-place-mode 1) (show-paren-mode 1) +(recentf-mode 1) +(savehist-mode 1) +(when (and (featurep 'pixel-scroll) (display-graphic-p)) + (pixel-scroll-mode 1)) + (menu-bar-mode 0) (scroll-bar-mode 0) (tool-bar-mode 0) diff --git a/init/company/init-company.el b/init/company/init-company.el deleted file mode 100644 index 633efe7..0000000 --- a/init/company/init-company.el +++ /dev/null @@ -1,8 +0,0 @@ -(require 'company) - -(setq company-idle-delay 0 - company-clang-executable "/usr/lib/llvm/11/bin/clang" - company-clang-insert-arguments nil - company-minimum-prefix-length 1) - -(provide 'init-company) diff --git a/init/compile/init-compile.el b/init/compile/init-compile.el deleted file mode 100644 index 874aa73..0000000 --- a/init/compile/init-compile.el +++ /dev/null @@ -1,3 +0,0 @@ -(add-hook 'compilation-mode-hook 'visual-line-mode) - -(provide 'init-compile) diff --git a/init/conf-mode/init-conf-mode-hooks.el b/init/conf-mode/init-conf-mode-hooks.el deleted file mode 100644 index c662e45..0000000 --- a/init/conf-mode/init-conf-mode-hooks.el +++ /dev/null @@ -1 +0,0 @@ -(setq conf-mode-hook (copy-tree text-mode-hook)) diff --git a/init/conf-mode/init-conf-mode.el b/init/conf-mode/init-conf-mode.el deleted file mode 100644 index 4a77537..0000000 --- a/init/conf-mode/init-conf-mode.el +++ /dev/null @@ -1,5 +0,0 @@ -(require 'init-text-mode) - -(load "init-conf-mode-hooks") - -(provide 'init-conf-mode) diff --git a/init/dired/init-dired.el b/init/dired/init-dired.el deleted file mode 100644 index 1d47ccf..0000000 --- a/init/dired/init-dired.el +++ /dev/null @@ -1,4 +0,0 @@ -(setq dired-listing-switches "-alh" - dired-kill-when-opening-new-dired-buffer t) - -(provide 'init-dired) diff --git a/init/display-buffer/init-display-buffer-best-side.el b/init/display-buffer/init-display-buffer-best-side.el deleted file mode 100644 index e0f588a..0000000 --- a/init/display-buffer/init-display-buffer-best-side.el +++ /dev/null @@ -1,7 +0,0 @@ -(defun init-display-buffer-frame-wide-p () - (> (frame-pixel-width) (/ (x-display-pixel-width) 2))) - -(defun init-display-buffer-best-side (buffer alist) - (let* ((side (funcall (alist-get 'which-side alist))) - (alist (append (cdr alist) (list (cons 'side side))))) - (display-buffer-in-side-window buffer alist))) diff --git a/init/display-buffer/init-display-buffer.el b/init/display-buffer/init-display-buffer.el deleted file mode 100644 index f1c4290..0000000 --- a/init/display-buffer/init-display-buffer.el +++ /dev/null @@ -1,5 +0,0 @@ -(setq display-buffer-base-action '(display-buffer-same-window display-buffer-reuse-window)) - -(load "init-display-buffer-best-side") - -(provide 'init-display-buffer) diff --git a/init/ediff/init-ediff.el b/init/ediff/init-ediff.el deleted file mode 100644 index 01a02b2..0000000 --- a/init/ediff/init-ediff.el +++ /dev/null @@ -1,4 +0,0 @@ -(setq ediff-split-window-function 'split-window-horizontally - ediff-window-setup-function 'ediff-setup-windows-plain) - -(provide 'init-ediff) diff --git a/init/eglot/init-eglot.el b/init/eglot/init-eglot.el deleted file mode 100644 index 128f7fb..0000000 --- a/init/eglot/init-eglot.el +++ /dev/null @@ -1,4 +0,0 @@ -(setq eglot-autoshutdown t - eglot-events-buffer-size 0) - -(provide 'init-eglot) diff --git a/init/eldoc/init-eldoc.el b/init/eldoc/init-eldoc.el deleted file mode 100644 index c4568e0..0000000 --- a/init/eldoc/init-eldoc.el +++ /dev/null @@ -1,4 +0,0 @@ -(setq eldoc-idle-delay 0 - eldoc-echo-area-use-multiline-p 5) - -(provide 'init-eldoc) diff --git a/init/electric/init-electric.el b/init/electric/init-electric.el deleted file mode 100644 index 7d668b6..0000000 --- a/init/electric/init-electric.el +++ /dev/null @@ -1,7 +0,0 @@ -(require 'electric) -(require 'elec-pair) - -(add-to-list 'electric-pair-pairs '("?(" . "?)")) -(add-to-list 'electric-pair-pairs '("?{" . "?}")) - -(provide 'init-electric) diff --git a/init/flycheck/init-flycheck-cargo-has-command-p-fix.el b/init/flycheck/init-flycheck-cargo-has-command-p-fix.el deleted file mode 100644 index 48d53d6..0000000 --- a/init/flycheck/init-flycheck-cargo-has-command-p-fix.el +++ /dev/null @@ -1,7 +0,0 @@ -(defun init-flycheck-rust-cargo-has-command-p (command) - (let* ((commands (process-lines "cargo" "--list")) - (trimmed (-map (lambda (row) (-slice row 4 (string-search " " 4))) commands))) - (seq-contains-p (-rest trimmed) command))) - -(advice-add 'flycheck-rust-cargo-has-command-p - :override 'init-flycheck-rust-cargo-has-command-p) diff --git a/init/flycheck/init-flycheck.el b/init/flycheck/init-flycheck.el deleted file mode 100644 index ee59ef8..0000000 --- a/init/flycheck/init-flycheck.el +++ /dev/null @@ -1,15 +0,0 @@ -(require 'flycheck) - -(load "init-flycheck-cargo-has-command-p-fix") - -(add-hook 'flycheck-error-list-mode-hook (lambda () (visual-line-mode 1))) - -(add-to-list 'display-buffer-alist '("\\*Flycheck errors.*" - (init-display-buffer-best-side) - (which-side . (lambda () - (if (init-display-buffer-frame-wide-p) - 'right - 'bottom))))) - - -(provide 'init-flycheck) diff --git a/init/flymake/init-flymake-hooks.el b/init/flymake/init-flymake-hooks.el deleted file mode 100644 index a19bc3c..0000000 --- a/init/flymake/init-flymake-hooks.el +++ /dev/null @@ -1,2 +0,0 @@ -(add-hook 'flymake-diagnostics-buffer-mode-hook (lambda () - (visual-line-mode 1))) diff --git a/init/flymake/init-flymake.el b/init/flymake/init-flymake.el deleted file mode 100644 index 0fbd45a..0000000 --- a/init/flymake/init-flymake.el +++ /dev/null @@ -1,12 +0,0 @@ -(require 'flymake) - -(load "init-flymake-hooks") - -(add-to-list 'display-buffer-alist '("\\*Flymake diagnostics.*" - (init-display-buffer-best-side) - (which-side . (lambda () - (if (init-display-buffer-frame-wide-p) - 'right - 'bottom))))) - -(provide 'init-flymake) diff --git a/init/garbage-collection/init-garbage-collection.el b/init/garbage-collection/init-garbage-collection.el deleted file mode 100644 index 96b2252..0000000 --- a/init/garbage-collection/init-garbage-collection.el +++ /dev/null @@ -1,3 +0,0 @@ -(setq gc-cons-threshold (* (expt 1024 2) 25)) - -(provide 'init-garbage-collection) diff --git a/init/ibuffer/init-ibuffer-filter-groups.el b/init/ibuffer/init-ibuffer-filter-groups.el deleted file mode 100644 index fbdd8ff..0000000 --- a/init/ibuffer/init-ibuffer-filter-groups.el +++ /dev/null @@ -1,10 +0,0 @@ -(setq ibuffer-saved-filter-groups - '(("default" - ("Misc" (and (name . "^\\*.*$") - (not (mode . Man-mode)))) - ("Dired" (mode . dired-mode)) - ("Man" (mode . Man-mode))))) - -(add-hook 'ibuffer-mode-hook (lambda () (ibuffer-switch-to-saved-filter-groups "default"))) - -(provide 'init-ibuffer-filter-groups) diff --git a/init/ibuffer/init-ibuffer-human-readable-size.el b/init/ibuffer/init-ibuffer-human-readable-size.el deleted file mode 100644 index 6d62521..0000000 --- a/init/ibuffer/init-ibuffer-human-readable-size.el +++ /dev/null @@ -1,16 +0,0 @@ -(define-ibuffer-column size-human-readable - (:name "Size" :inline t) - (let ((size (buffer-size))) - (cond - ((> size (expt 1000 4)) - (error "buffer is over 1TB large!")) - ((> size (expt 1000 3)) - (format "%sG" (/ size (expt 1000 3)))) - ((> size (expt 1000 2)) - (format "%sM" (/ size (expt 1000 2)))) - ((> size 1000) - (format "%sK" (/ size 1000))) - (t - (format "%sB" size))))) - -(provide 'init-ibuffer-human-readable-size) diff --git a/init/ibuffer/init-ibuffer-never-show.el b/init/ibuffer/init-ibuffer-never-show.el deleted file mode 100644 index a122194..0000000 --- a/init/ibuffer/init-ibuffer-never-show.el +++ /dev/null @@ -1,11 +0,0 @@ -(defvar init-ibuffer-never-show '("^\\*Messages\\*$" - "^\\*Completions\\*$" - "^\\*Async-native-compile-log\\*$" - "^\\*Native-compile-Log\\*$" - "^\\*Warnings\\*$")) - -(mapc (lambda (p) - (add-to-list 'ibuffer-never-show-predicates p)) - init-ibuffer-never-show) - -(provide 'init-ibuffer-never-show) diff --git a/init/ibuffer/init-ibuffer.el b/init/ibuffer/init-ibuffer.el deleted file mode 100644 index 9b504d4..0000000 --- a/init/ibuffer/init-ibuffer.el +++ /dev/null @@ -1,21 +0,0 @@ -(require 'ibuffer) -(require 'ibuf-ext) -(require 'init-ibuffer-human-readable-size) -(require 'init-ibuffer-never-show) - -(setq ibuffer-display-summary nil - ibuffer-expert t) - -(setq ibuffer-formats - '((mark modified read-only locked " " - (name 32 32 :left :elide) - " " - (size-human-readable 5 5 :right) - " " - (mode 16 16 :left :elide) - " " filename-and-process) - (mark " " - (name 16 -1) - " " filename))) - -(provide 'init-ibuffer) diff --git a/init/ielm/init-ielm.el b/init/ielm/init-ielm.el deleted file mode 100644 index 29bf795..0000000 --- a/init/ielm/init-ielm.el +++ /dev/null @@ -1,3 +0,0 @@ -(add-hook 'ielm-mode-hook 'visual-line-mode) - -(provide 'init-ielm) diff --git a/init/keys/init-keys.el b/init/keys/init-keys.el deleted file mode 100644 index 4153a46..0000000 --- a/init/keys/init-keys.el +++ /dev/null @@ -1,12 +0,0 @@ -(global-unset-key (kbd "")) -(global-unset-key (kbd "")) -(global-unset-key (kbd "")) -(global-unset-key (kbd "")) -(global-unset-key (kbd "")) -(global-unset-key (kbd "")) -(global-unset-key (kbd "")) -(global-unset-key (kbd "")) -(global-set-key (kbd "C-x k") 'kill-this-buffer) -(global-set-key (kbd "C-x C-b") 'ibuffer) - -(provide 'init-keys) diff --git a/init/lsp-mode/init-lsp-mode-disable-install-server.el b/init/lsp-mode/init-lsp-mode-disable-install-server.el deleted file mode 100644 index ed5e73a..0000000 --- a/init/lsp-mode/init-lsp-mode-disable-install-server.el +++ /dev/null @@ -1,40 +0,0 @@ -(setq lsp-server-install-dir "/somewhere/that/doesnt/exist") - -(defun init-lsp-mode-disable-install-server-error () - (error "lsp-mode server install features have been disabled")) - -(advice-add 'lsp-install-server - :around - 'init-lsp-mode-disable-install-server-error) - -(advice-add 'lsp-update-server - :around - 'init-lsp-mode-disable-install-server-error) - -(advice-add 'lsp-update-servers - :around - 'init-lsp-mode-disable-install-server-error) - -(advice-add 'lsp-download-install - :around - 'init-lsp-mode-disable-install-server-error) - -(advice-add 'lsp-download-path - :around - 'init-lsp-mode-disable-install-server-error) - -(advice-add 'lsp-async-start-process - :around - 'init-lsp-mode-disable-install-server-error) - -(advice-add 'lsp--download-status - :around - 'init-lsp-mode-disable-install-server-error) - -(advice-add 'lsp--install-server-internal - :around - 'init-lsp-mode-disable-install-server-error) - -(advice-add 'lsp--npm-dependency-install - :around - 'init-lsp-mode-disable-install-server-error) diff --git a/init/lsp-mode/init-lsp-mode.el b/init/lsp-mode/init-lsp-mode.el deleted file mode 100644 index f77e503..0000000 --- a/init/lsp-mode/init-lsp-mode.el +++ /dev/null @@ -1,19 +0,0 @@ -(require 'lsp-mode) -(require 'flycheck) - -(setq lsp-enable-dap-auto-configure nil - lsp-enable-folding nil - lsp-enable-indentation t - lsp-enable-on-type-formatting nil - lsp-completion-enable nil - lsp-enable-snippet nil - lsp-modeline-code-actions-enable nil - lsp-lens-enable nil - lsp-signature-auto-activate nil - lsp-eldoc-render-all t - lsp-rls-server-command nil - lsp-enable-suggest-server-download nil) - -(load "init-lsp-mode-disable-install-server") - -(provide 'init-lsp-mode) diff --git a/init/man/init-man.el b/init/man/init-man.el deleted file mode 100644 index 521f491..0000000 --- a/init/man/init-man.el +++ /dev/null @@ -1,3 +0,0 @@ -(setq Man-notify-method 'pushy) - -(provide 'init-man) diff --git a/init/mode-line/init-mode-line.el b/init/mode-line/init-mode-line.el deleted file mode 100644 index 1846031..0000000 --- a/init/mode-line/init-mode-line.el +++ /dev/null @@ -1,16 +0,0 @@ -(setq-default mode-line-format '("%*" - " " - (:eval (if buffer-file-name - (abbreviate-file-name buffer-file-name) - (buffer-name))) - " " - "(" mode-name ")" - " " - "[" (:eval (abbreviate-file-name default-directory)) "]" - " " - "(" (:eval (if server-process - (process-name server-process) - "none")) - ")")) - -(provide 'init-mode-line) diff --git a/init/native-comp/init-native-comp.el b/init/native-comp/init-native-comp.el deleted file mode 100644 index 630a083..0000000 --- a/init/native-comp/init-native-comp.el +++ /dev/null @@ -1,4 +0,0 @@ -(setq native-comp-async-jobs-number (string-to-number (shell-command-to-string "nproc")) - native-compile-target-directory temporary-file-directory) - -(provide 'init-native-comp) diff --git a/init/package/init-package.el b/init/package/init-package.el deleted file mode 100644 index 3e2129d..0000000 --- a/init/package/init-package.el +++ /dev/null @@ -1,4 +0,0 @@ -(setq package-archives nil - package-check-signature 'all) - -(provide 'init-package) diff --git a/init/pixel-scroll/init-pixel-scroll.el b/init/pixel-scroll/init-pixel-scroll.el deleted file mode 100644 index c28440c..0000000 --- a/init/pixel-scroll/init-pixel-scroll.el +++ /dev/null @@ -1,10 +0,0 @@ -(require 'pixel-scroll) - -(setq mouse-wheel-progressive-speed nil - pixel-dead-time 0 - pixel-wait 0 - pixel-resolution-fine-flag 10) - -(pixel-scroll-mode 1) - -(provide 'init-pixel-scroll) diff --git a/init/prog-mode/init-prog-mode-hooks.el b/init/prog-mode/init-prog-mode-hooks.el deleted file mode 100644 index a3c63e0..0000000 --- a/init/prog-mode/init-prog-mode-hooks.el +++ /dev/null @@ -1 +0,0 @@ -(setq prog-mode-hook (copy-tree text-mode-hook)) diff --git a/init/prog-mode/init-prog-mode.el b/init/prog-mode/init-prog-mode.el deleted file mode 100644 index eec9811..0000000 --- a/init/prog-mode/init-prog-mode.el +++ /dev/null @@ -1,5 +0,0 @@ -(require 'init-text-mode) - -(load "init-prog-mode-hooks") - -(provide 'init-prog-mode) diff --git a/init/project/init-project-find-rust-projects.el b/init/project/init-project-find-rust-projects.el deleted file mode 100644 index 65359bd..0000000 --- a/init/project/init-project-find-rust-projects.el +++ /dev/null @@ -1,4 +0,0 @@ -(add-to-list 'project-find-functions (lambda (directory) - (let ((rust-project (locate-dominating-file directory "Cargo.toml"))) - (when rust-project - (cons 'transient rust-project))))) diff --git a/init/project/init-project.el b/init/project/init-project.el deleted file mode 100644 index 2e83d81..0000000 --- a/init/project/init-project.el +++ /dev/null @@ -1,3 +0,0 @@ -(load "init-project-find-rust-projects") - -(provide 'init-project) diff --git a/init/recentf/init-recentf.el b/init/recentf/init-recentf.el deleted file mode 100644 index 17617bc..0000000 --- a/init/recentf/init-recentf.el +++ /dev/null @@ -1,6 +0,0 @@ -(setq recentf-max-menu-items 25 - recentf-max-saved-items 25) - -(recentf-mode 1) - -(provide 'init-recentf) diff --git a/init/savehist/init-savehist.el b/init/savehist/init-savehist.el deleted file mode 100644 index 5beea5e..0000000 --- a/init/savehist/init-savehist.el +++ /dev/null @@ -1,15 +0,0 @@ -(require 'savehist) - -(defvar init-savehist-history-size 9999999999) - -(setq savehist-file (expand-file-name "savehist" user-emacs-directory) - savehist-save-minibuffer-history t) - -(add-to-list 'savehist-additional-variables `(command-history . ,init-savehist-history-size)) - -(unless (file-exists-p savehist-file) - (make-empty-file savehist-file)) - -(savehist-mode 1) - -(provide 'init-savehist) diff --git a/init/text-mode/init-text-mode-hooks.el b/init/text-mode/init-text-mode-hooks.el deleted file mode 100644 index f740e0c..0000000 --- a/init/text-mode/init-text-mode-hooks.el +++ /dev/null @@ -1,9 +0,0 @@ -(add-hook 'text-mode-hook (lambda () - (display-line-numbers-mode 1) - (visual-line-mode 1) - (display-fill-column-indicator-mode 1) - (electric-pair-mode 1) - (electric-indent-mode 1) - (setq-local display-fill-column-indicator-column 120) - (when (require 'highlight-indentation nil t) - (highlight-indentation-mode 1)))) diff --git a/init/text-mode/init-text-mode.el b/init/text-mode/init-text-mode.el deleted file mode 100644 index 4318c95..0000000 --- a/init/text-mode/init-text-mode.el +++ /dev/null @@ -1,3 +0,0 @@ -(load "init-text-mode-hooks") - -(provide 'init-text-mode) diff --git a/init/tramp/init-tramp-connection-properties.el b/init/tramp/init-tramp-connection-properties.el deleted file mode 100644 index 88f2dfd..0000000 --- a/init/tramp/init-tramp-connection-properties.el +++ /dev/null @@ -1,2 +0,0 @@ -(add-to-list 'tramp-connection-properties (list (regexp-quote (format "/sudo:root@%s:" system-name)) - "session-timeout" (* 60 20))) diff --git a/init/tramp/init-tramp-sudo-hang-fix.el b/init/tramp/init-tramp-sudo-hang-fix.el deleted file mode 100644 index 3882f28..0000000 --- a/init/tramp/init-tramp-sudo-hang-fix.el +++ /dev/null @@ -1,3 +0,0 @@ -(defun sudo-edit () - (interactive) - (find-file (format "/sudo:root@%s:%s" system-name (read-file-name "Edit as root: ")))) diff --git a/init/tramp/init-tramp.el b/init/tramp/init-tramp.el deleted file mode 100644 index aad0582..0000000 --- a/init/tramp/init-tramp.el +++ /dev/null @@ -1,10 +0,0 @@ -(require 'tramp) - -(setq password-cache nil - password-cache-expiry 0 - tramp-persistency-file-name nil) - -(load "init-tramp-connection-properties") -(load "init-tramp-sudo-hang-fix") - -(provide 'init-tramp) diff --git a/init/treesit/init-treesit-setup-available-languages.el b/init/treesit/init-treesit-setup-available-languages.el deleted file mode 100644 index 9a25691..0000000 --- a/init/treesit/init-treesit-setup-available-languages.el +++ /dev/null @@ -1,97 +0,0 @@ -;; -*- lexical-binding: t; -*- - -;; This script is a quick workaround for setting up treesitter modes. -;; Hopefully this won't be needed for long but it works for now! -;; -;; This just runs through the list of modes below, checks if the -;; required treesitter parsers are installed, and if so, -;; sets up auto-mode-alist and interpreter-mode-alist -;; to open the respective source files with the treesitter -;; mode for that language. -;; -;; To use, you should just add the modes and other info to the list -;; below, and then "require" this file in your init. -;; The messages that get generated by this script may be burried -;; by other startup messages, so it may not appear to have done -;; anything! -;; -;; To test if it works, visit a file such as "x.py", then run -;; "M-x describe-mode". There should be some info about -;; the current major mode that looks like this: -;; -;; "The major mode is Python mode defined in python.el: -;; Major mode for editing Python files, using tree-sitter library." - -(defvar -quiet? nil - "Suppress messages when setting up treesitter modes.") - -(defvar -modes `((python-ts-mode - ((:parsers . python) - (:file-ext . ,(rx ".py")) - (:interpreters . ("python" "python3")))) - (rust-ts-mode - ((:parsers . rust) - (:file-ext . ,(rx ".rs")))) - (bash-ts-mode - ((:parsers . bash) - (:file-ext . ,(rx ".sh")) - (:interpreters . ("bash" "sh" "openrc-run")))) - (c-ts-mode - ((:parsers . c) - (:file-ext . ,(rx ".c")))) - (c++-ts-mode - ((:parsers . cpp) - (:file-ext . ,(rx (or ".c++" ".cpp" ".cxx" - ".h++" ".hpp" ".hxx"))))) - (c-or-c++-ts-mode - ((:parsers . (c c++)) - (:file-ext . ,(rx ".h")))) - (toml-ts-mode - ((:parsers . toml) - (:file-ext . ,(rx ".toml"))))) - "Treesitter modes and some information required to set them up. - -Parsers are the treesitter packages that need to be installed to -use the associated mode. python-ts-mode requires the python treesitter -parser package to be installed for example. - -File extension is for example .py for python scripts. Some -modes like c++-ts-mode are associated with a few -extensions, and c-or-c++-mode is associated with .h -because the extension is ambiguous. - -Interpreters are used to associate certain shebangs with the treesitter -mode. Files that start with '#!/usr/bin/env python' for example will -be associated with python-ts-mode if 'python' is included in the -interpreters list.") - -(defun -ready-quiet? (parser) - (treesit-ready-p parser t)) - -(cl-defun -setup-mode? (&key ts-mode - required-parsers - file-extensions - interpreters) - (when (seq-every-p '-ready-quiet? (ensure-list required-parsers)) - (add-to-list 'auto-mode-alist (cons file-extensions ts-mode)) - (when interpreters - (seq-each (lambda (interpreter) - (add-to-list 'interpreter-mode-alist (cons interpreter ts-mode))) - (ensure-list interpreters))) - t)) - -(seq-each (lambda (mode) - (when (and (-setup-mode? - :ts-mode (car mode) - :required-parsers (alist-get :parsers (cadr mode)) - :file-extensions (alist-get :file-ext (cadr mode)) - :interpreters (alist-get :interpreters (cadr mode))) - (not -quiet?)) - (message "Setup treesitter mode %s" (car mode)))) - -modes) - -(provide 'init-treesit-setup-available-languages) - -;; Local Variables: -;; read-symbol-shorthands: (("-" . "init-treesit-setup-available-languages-")) -;; End: diff --git a/init/treesit/init-treesit.el b/init/treesit/init-treesit.el deleted file mode 100644 index 29ea075..0000000 --- a/init/treesit/init-treesit.el +++ /dev/null @@ -1,3 +0,0 @@ -(require 'init-treesit-setup-available-languages) - -(provide 'init-treesit) diff --git a/lisp/packages.el b/lisp/packages.el new file mode 100644 index 0000000..ff3e6f6 --- /dev/null +++ b/lisp/packages.el @@ -0,0 +1,27 @@ +;;; packages.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2023 + +;; Author: John Turner + +;; 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 . + +(use-package man-completion + :load-path (lambda () (locate-user-emacs-file "lisp/man-completion"))) + +(use-package reload-library + :load-path (lambda () (locate-user-emacs-file "lisp/reload-library"))) + +(use-package toggle-local-vars + :load-path (lambda () (locate-user-emacs-file "lisp/toggle-local/vars")))