]> xn--ix-yja.es Git - alex.git/commitdiff
Clean up a bit
authoralex <alex@pdp7.net>
Sun, 5 Nov 2023 17:52:22 +0000 (18:52 +0100)
committeralex <alex@pdp7.net>
Sun, 5 Nov 2023 17:52:38 +0000 (18:52 +0100)
emacs/emacs.el

index 023fc7a469def7d222c85fe156b770bf209524e8..0ac9a46dfca2aabf48b628f164b414d086c7681d 100644 (file)
 (setq scroll-conservatively 10000)
 (setq auto-window-vscroll nil)
 
+;; Do not spill temporary files everywhere
+;; https://stackoverflow.com/a/18330742
+(defvar --backup-directory (concat user-emacs-directory "backups"))
+(if (not (file-exists-p --backup-directory))
+        (make-directory --backup-directory t))
+(setq backup-directory-alist `(("." . ,--backup-directory)))
+
 ;; Colorblind friendly theme.
 (require-theme 'modus-themes)
 (load-theme 'modus-operandi :no-confirm)
 (package-initialize)
 
 ;; Install xclip so cutting/copying in Emacs on a terminal affects the graphical clipboard
-
 (use-package xclip
   :ensure t
-  :init
+  :config
   (xclip-mode 1))
 
 ;; Fancy undo
-
 (use-package undo-tree
-  :ensure t)
-
-(global-undo-tree-mode)
-(setq undo-tree-visualizer-diff t)
-(setq undo-tree-visualizer-timestamp t)
-(setq undo-tree-auto-save-history t)
-
-;; Do not spill temporary files everywhere
-
-;; https://stackoverflow.com/a/18330742
-(defvar --backup-directory (concat user-emacs-directory "backups"))
-(if (not (file-exists-p --backup-directory))
-        (make-directory --backup-directory t))
-(setq backup-directory-alist `(("." . ,--backup-directory)))
-
-;; https://www.reddit.com/r/emacs/comments/tejte0/undotree_bug_undotree_files_scattering_everywhere/?rdt=39892
-(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo")))
+  :ensure t
+  :config
+  (global-undo-tree-mode)
+  (setq undo-tree-visualizer-diff t)
+  (setq undo-tree-visualizer-timestamp t)
+  (setq undo-tree-auto-save-history t)
+  ;; https://www.reddit.com/r/emacs/comments/tejte0/undotree_bug_undotree_files_scattering_everywhere/?rdt=39892
+  (setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo"))))
 
 ;; nicer completion UI
-
 (use-package helm
-  :ensure t)
-
-(global-set-key (kbd "M-x") #'helm-M-x)
-(global-set-key (kbd "C-x C-f") #'helm-find-files)
-(global-set-key (kbd "C-x C-b") #'helm-mini)
-
-(setq helm-ff-skip-boring-files t)
+  :ensure t
+  :config
+  (global-set-key (kbd "M-x") #'helm-M-x)
+  (global-set-key (kbd "C-x C-f") #'helm-find-files)
+  (global-set-key (kbd "C-x C-b") #'helm-mini)
+  (setq helm-ff-skip-boring-files t))
 
 ;; LSP base for Rust and Java
-
 (use-package lsp-mode
   :ensure t)
+
 (use-package company
-  :ensure t)
-(add-hook 'after-init-hook 'global-company-mode)
+  :ensure t
+  :config
+  (add-hook 'after-init-hook 'global-company-mode))
 
 (use-package lsp-ui
   :ensure t)
 (use-package yasnippet
   :ensure t)
 
-(add-hook 'java-mode-hook (lambda ()
-                            (setq c-basic-offset 2
-                                  indent-tabs-mode f)))
-
 (yas-global-mode 1)
 
 ;; Rust support
-
 (use-package rust-mode
-  :ensure t)
-(add-hook 'rust-mode-hook #'lsp)
-(add-hook 'rust-mode-hook
-          (lambda () (setq indent-tabs-mode nil)))
-(setq rust-format-on-save t)
+  :ensure t
+  :config
+  (add-hook 'rust-mode-hook #'lsp)
+  (add-hook 'rust-mode-hook
+            (lambda () (setq indent-tabs-mode nil)))
+  (setq rust-format-on-save t))
 
 ;; Python support
-
 ; https://github.com/jorgenschaefer/elpy/issues/1890#issuecomment-792361668
 ; Need to downgrade jedi to get it to work :(
 (use-package elpy
   (elpy-enable))
 
 ;;; Java Support
-
 (use-package lsp-java
-  :ensure t)
-(add-hook 'java-mode-hook 'lsp)
+  :ensure t
+  :config
+  (add-hook 'java-mode-hook 'lsp)
+  (add-hook 'java-mode-hook (lambda ()
+                              (setq c-basic-offset 2
+                                    indent-tabs-mode f))))
 
 ;; YAML support
-
 (use-package yaml-mode
   :ensure t)
 
 ;; lsp-mode seems unusably slow, so don't install the Ansible language server
 ;; if you want to get it working, try https://www.reddit.com/r/emacs/comments/ybbkks/how_to_properly_set_up_lsp_ansible_language/itfxoaa/
-
 (use-package ansible
-  :ensure t)
-(add-hook 'yaml-mode-hook 'ansible)
+  :ensure t
+  :config
+  (add-hook 'yaml-mode-hook 'ansible))
 
 ;; Puppet support; mostly for syntax highlighting
 
 ;; ==== WORK ====
 
 ;; Abbrevs for work, declared in emacs.el for version control
-
 (clear-abbrev-table global-abbrev-table)
 
 (progn
 (setq save-abbrevs nil)
 
 ;; AsciiDoc + Vale + Aspell support for work
-
 (use-package adoc-mode
-  :ensure t)
-(add-hook 'adoc-mode-hook #'abbrev-mode)
+  :ensure t
+  :config
+  (add-hook 'adoc-mode-hook #'abbrev-mode))
 
 (cl-defun slot/vc-install (&key (fetcher "github") repo name rev backend)
   (let* ((url (format "https://www.%s.com/%s" fetcher repo))