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