Fixup various formatting/indentation issues in init.el

This commit is contained in:
Adam Goldsmith 2024-08-14 23:10:28 -04:00
parent 5593220049
commit 8dfa1cf6be

View File

@ -87,8 +87,8 @@
(name . "^\\*scratch\\*$") (name . "^\\*scratch\\*$")
(name . "^\\*Messages\\*$"))))))) (name . "^\\*Messages\\*$")))))))
(add-hook 'ibuffer-mode-hook (lambda () (add-hook 'ibuffer-mode-hook (lambda ()
(ibuffer-auto-mode 1) (ibuffer-auto-mode 1)
(setq ibuffer-show-empty-filter-groups nil)))) (setq ibuffer-show-empty-filter-groups nil))))
(use-package sgml-mode (use-package sgml-mode
:hook ((sgml-mode nxml-mode html-mode web-mode) :hook ((sgml-mode nxml-mode html-mode web-mode)
@ -127,9 +127,9 @@
(use-package python (use-package python
:config :config
(when (executable-find "ipython") (when (executable-find "ipython")
(setq python-shell-interpreter "ipython") (setq python-shell-interpreter "ipython")
(setq python-shell-interpreter-args "-i --simple-prompt") (setq python-shell-interpreter-args "-i --simple-prompt")
(add-to-list 'python-shell-completion-native-disabled-interpreters "ipython"))) (add-to-list 'python-shell-completion-native-disabled-interpreters "ipython")))
(use-package tramp (use-package tramp
:bind ("C-c C-f" . find-file-as-root) :bind ("C-c C-f" . find-file-as-root)
@ -151,8 +151,7 @@
comint-input-ignoredups t ; no duplicates in command history comint-input-ignoredups t ; no duplicates in command history
comint-completion-addsuffix t ; insert space/slash after file completion comint-completion-addsuffix t ; insert space/slash after file completion
comint-buffer-maximum-size 20000 ; max length of the buffer in lines comint-buffer-maximum-size 20000 ; max length of the buffer in lines
comint-get-old-input (lambda () "") ; what to run when i press enter on a comint-get-old-input (lambda () "") ; what to run when i press enter on a line above the current prompt
; line above the current prompt
comint-input-ring-size 500) ; max shell history size comint-input-ring-size 500) ; max shell history size
(add-hook 'comint-mode-hook (add-hook 'comint-mode-hook
(lambda () (setq-local show-trailing-whitespace nil)))) (lambda () (setq-local show-trailing-whitespace nil))))
@ -170,7 +169,7 @@
global-semantic-idle-local-symbol-highlight-mode) global-semantic-idle-local-symbol-highlight-mode)
semantic-idle-scheduler-idle-time 0.2) semantic-idle-scheduler-idle-time 0.2)
; inhibit semantic outside of specific modes ;; inhibit semantic outside of specific modes
(setq semantic-inhibit-functions (setq semantic-inhibit-functions
(lambda () (not (member major-mode '(c-mode cc-mode java-mode))))) (lambda () (not (member major-mode '(c-mode cc-mode java-mode)))))
@ -180,7 +179,7 @@
(use-package term (use-package term
:config :config
(add-hook 'term-mode-hook (add-hook 'term-mode-hook
; if this is t, it breaks shell-command ;; if this is t, it breaks shell-command
(lambda () (setq-local comint-prompt-read-only nil)))) (lambda () (setq-local comint-prompt-read-only nil))))
(use-package gud (use-package gud
@ -283,12 +282,12 @@
(use-package help-mode (use-package help-mode
:config :config
; bind "g" to revert help buffers with no prompt ;; bind "g" to revert help buffers with no prompt
(bind-key "g" (lambda () (interactive) (revert-buffer t t)) help-mode-map)) (bind-key "g" (lambda () (interactive) (revert-buffer t t)) help-mode-map))
(use-package files (use-package files
:config :config
; bind a key to revert buffers with no prompt ;; bind a key to revert buffers with no prompt
(bind-key "C-x M-v" (lambda () (interactive) (revert-buffer t t t)))) (bind-key "C-x M-v" (lambda () (interactive) (revert-buffer t t t))))
(use-package prog-mode (use-package prog-mode
@ -328,7 +327,7 @@
:config :config
(setq ns-command-modifier 'hyper) (setq ns-command-modifier 'hyper)
(server-start) (server-start)
; disable focus stealing ;; disable focus stealing
(defun raise-frame (frame) (interactive) nil)) (defun raise-frame (frame) (interactive) nil))
(use-package yaml-mode (use-package yaml-mode
@ -341,8 +340,8 @@
(auth-source-pass-enable) (auth-source-pass-enable)
(defun auth-source-pass--remap (orig-fun host &optional user port) (defun auth-source-pass--remap (orig-fun host &optional user port)
(let ((new-host (pcase host (let ((new-host (pcase host
("hosting" "hosting.tardisventures.net") ("hosting" "hosting.tardisventures.net")
(_ host))) (_ host)))
(new-user (if (string= port "sudo") (user-login-name) user))) (new-user (if (string= port "sudo") (user-login-name) user)))
(message "remapped %s@%s:%s -> %s@%s:%s" host user port new-host new-user port) (message "remapped %s@%s:%s -> %s@%s:%s" host user port new-host new-user port)
(funcall orig-fun new-host new-user port))) (funcall orig-fun new-host new-user port)))
@ -516,7 +515,7 @@
(use-package hydra :ensure :demand (use-package hydra :ensure :demand
:config :config
;config is in separate file because it is really big ;; config is in separate file because it is really big
(load-file "~/.emacs.d/hydra-defs.el") (load-file "~/.emacs.d/hydra-defs.el")
:bind (("C-c w" . 'hydra-window/body) :bind (("C-c w" . 'hydra-window/body)
("C-c s" . 'hydra-shortcuts/body) ("C-c s" . 'hydra-shortcuts/body)
@ -577,7 +576,7 @@
(use-package frames-only-mode :ensure :demand (use-package frames-only-mode :ensure :demand
:config :config
; seems to need to be before mode init ;; seems to need to be before mode init
(add-to-list 'frames-only-mode-use-window-functions 'undo-tree-visualize) (add-to-list 'frames-only-mode-use-window-functions 'undo-tree-visualize)
(setq server-raise-frame nil) (setq server-raise-frame nil)
(defun x-focus-frame (FRAME &optional NOACTIVATE)) (defun x-focus-frame (FRAME &optional NOACTIVATE))
@ -596,7 +595,7 @@
(defun split-window-right-i3 () (defun split-window-right-i3 ()
"It's like `split-window-right', but uses i3 stuff when available" "It's like `split-window-right', but uses i3 stuff when available"
(interactive) (interactive)
(cond ((not (display-graphic-p)) (split-window-right)) (cond ((not (display-graphic-p)) (split-window-right))
((executable-find "i3") ((executable-find "i3")
(call-process "i3" nil nil nil "split h") (call-process "i3" nil nil nil "split h")
(make-frame)) (make-frame))
@ -723,10 +722,10 @@
:sasl-username "ad1217" :sasl-username "ad1217"
:sasl-password "ablablop" :sasl-password "ablablop"
:channels ("#emacs-circe" "#qutebrowser" "#archlinux" "##linux")) :channels ("#emacs-circe" "#qutebrowser" "#archlinux" "##linux"))
("WPI" ("WPI"
:host "irc.wpiirc.net" :host "irc.wpiirc.net"
:port 9999 :port 9999
:use-tls t)) :use-tls t))
circe-default-part-message "")) circe-default-part-message ""))
(use-package dtrt-indent (use-package dtrt-indent
@ -736,7 +735,7 @@
(use-package graphviz-dot-mode (use-package graphviz-dot-mode
:config :config
; don't auto-newline on semicolon ;; don't auto-newline on semicolon
(defun electric-graphviz-dot-semi () (defun electric-graphviz-dot-semi ()
"Terminate line and indent next line." "Terminate line and indent next line."
(interactive) (interactive)
@ -878,8 +877,8 @@
pkgbuild-user-mail-address "contact@adamgoldsmith.name" pkgbuild-user-mail-address "contact@adamgoldsmith.name"
pkgbuild-makepkg-command "PKGEXT='.pkg.tar' makepkg -mf") pkgbuild-makepkg-command "PKGEXT='.pkg.tar' makepkg -mf")
(defun pkgbuild-printsrcinfo () (defun pkgbuild-printsrcinfo ()
(interactive) (interactive)
(shell-command "makepkg --printsrcinfo > .SRCINFO")) (shell-command "makepkg --printsrcinfo > .SRCINFO"))
(defun pkgbuild-update-sums-line () (defun pkgbuild-update-sums-line ()
(interactive) (interactive)
(shell-command "updpkgsums") (shell-command "updpkgsums")
@ -937,11 +936,11 @@
(use-package nodejs-repl (use-package nodejs-repl
:bind* (:map js2-mode-map :bind* (:map js2-mode-map
("C-x C-e" . nodejs-repl-send-last-expression) ("C-x C-e" . nodejs-repl-send-last-expression)
("C-c C-r" . nodejs-repl-send-region) ("C-c C-r" . nodejs-repl-send-region)
("C-c C-l" . nodejs-repl-load-file) ("C-c C-l" . nodejs-repl-load-file)
("C-c C-z" . nodejs-repl-switch-to-repl) ("C-c C-z" . nodejs-repl-switch-to-repl)
("C-c C-c" . nodejs-repl-send-buffer)) ("C-c C-c" . nodejs-repl-send-buffer))
:config :config
(unbind-key "C-c C-c" tern-mode-keymap)) (unbind-key "C-c C-c" tern-mode-keymap))
@ -980,9 +979,8 @@
(defun nm-sticky-tag-and-next (tags) (defun nm-sticky-tag-and-next (tags)
(interactive (interactive
(if (or current-prefix-arg (null nm-sticky-tags)) (if (or current-prefix-arg (null nm-sticky-tags))
(list (notmuch-tag-change-list (split-string (list (notmuch-tag-change-list
(read-string (split-string (read-string "tags: " (mapconcat 'identity nm-sticky-tags " ")))))
"tags: " (mapconcat 'identity nm-sticky-tags " ")))))
(list nm-sticky-tags))) (list nm-sticky-tags)))
(setq nm-sticky-tags tags) (setq nm-sticky-tags tags)
(nm-tag-and-next tags)) (nm-tag-and-next tags))
@ -1000,7 +998,7 @@
(use-package fortune-cookie :demand :if (package-installed-p 'fortune-cookie) (use-package fortune-cookie :demand :if (package-installed-p 'fortune-cookie)
:config :config
; change message every time scratch buffer created ;; change message every time scratch buffer created
(setq initial-major-mode (setq initial-major-mode
(lambda () (lambda ()
(setq initial-scratch-message (setq initial-scratch-message
@ -1055,14 +1053,14 @@
(setq org-lookup-dnd-chose 'org-lookup-dnd-chose-ivy (setq org-lookup-dnd-chose 'org-lookup-dnd-chose-ivy
org-lookup-dnd-link-format "[[pdf:%s::%d][%s]]") org-lookup-dnd-link-format "[[pdf:%s::%d][%s]]")
(setq org-lookup-dnd-sources t) (setq org-lookup-dnd-sources t)
;; '(("~/Documents/DnD/Books/D&D 5E - Player's Handbook.pdf" 1 4 4) ;; '(("~/Documents/DnD/Books/D&D 5E - Player's Handbook.pdf" 1 4 4)
;; ("~/Documents/DnD/Books/D&D 5E - Dungeon Master's Guide.pdf" 0 317 320) ;; ("~/Documents/DnD/Books/D&D 5E - Dungeon Master's Guide.pdf" 0 317 320)
;; ("~/Documents/DnD/Books/D&D 5E - Monster Manual.pdf" 1 352 353))) ;; ("~/Documents/DnD/Books/D&D 5E - Monster Manual.pdf" 1 352 353)))
(setq org-lookup-dnd-extra-index "~/Documents/DnD/dnd-phb-5e-index/indexes.org") (setq org-lookup-dnd-extra-index "~/Documents/DnD/dnd-phb-5e-index/indexes.org")
;; roughly org-lookup-dnd-parse, but without the pdf parsing ;; roughly org-lookup-dnd-parse, but without the pdf parsing
(setq org-lookup-dnd-db (setq org-lookup-dnd-db
(make-hash-table :test #'equal :size 256 :rehash-size 2.0 :rehash-threshold .97)) (make-hash-table :test #'equal :size 256 :rehash-size 2.0 :rehash-threshold .97))
(org-lookup-dnd-parse-extras) (org-lookup-dnd-parse-extras)
(org-lookup-dnd-dump-vars-to-file '(org-lookup-dnd-db) org-lookup-dnd-db-file)) (org-lookup-dnd-dump-vars-to-file '(org-lookup-dnd-db) org-lookup-dnd-db-file))
@ -1110,12 +1108,12 @@
(defun apheleia--check-formatter-configured () (defun apheleia--check-formatter-configured ()
"Disable apheleia when a formatter's configuration does not exist" "Disable apheleia when a formatter's configuration does not exist"
(let ((formatters (apheleia--get-formatters))) (let ((formatters (apheleia--get-formatters)))
(cond (cond
((member 'ruff formatters) (not (apheleia--pyproject-contains-section "tool.ruff"))) ((member 'ruff formatters) (not (apheleia--pyproject-contains-section "tool.ruff")))
((member 'black formatters) (not (apheleia--pyproject-contains-section "tool.black"))) ((member 'black formatters) (not (apheleia--pyproject-contains-section "tool.black")))
((member 'djlint formatters) (not (apheleia--pyproject-contains-section "tool.djlint"))) ((member 'djlint formatters) (not (apheleia--pyproject-contains-section "tool.djlint")))
((seq-some (lambda (f) (string-prefix-p "prettier" (symbol-name f))) formatters) ((seq-some (lambda (f) (string-prefix-p "prettier" (symbol-name f))) formatters)
(not (when (= 0 (call-process "prettier" nil nil nil "--find-config-path" (buffer-file-name))) (not (when (= 0 (call-process "prettier" nil nil nil "--find-config-path" (buffer-file-name)))
(let* ((config-file (shell-command-to-string (concat "prettier --find-config-path " (buffer-file-name)))) (let* ((config-file (shell-command-to-string (concat "prettier --find-config-path " (buffer-file-name))))
(default-directory (file-name-directory (expand-file-name config-file))) (default-directory (file-name-directory (expand-file-name config-file)))
(file-info (shell-command-to-string (concat "prettier --file-info " (buffer-file-name)))) (file-info (shell-command-to-string (concat "prettier --file-info " (buffer-file-name))))