diff options
Diffstat (limited to 'init.el')
-rw-r--r-- | init.el | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/init.el b/init.el index 864c4ff..f215f9d 100644 --- a/init.el +++ b/init.el | |||
@@ -279,10 +279,12 @@ | |||
279 | 279 | ||
280 | (:leader "s" eshell-pop-or-quit) | 280 | (:leader "s" eshell-pop-or-quit) |
281 | 281 | ||
282 | (hook-defun eshell-setup 'eshell-mode-hook | 282 | (add-hook 'eshell-mode-hook |
283 | (define-key eshell-mode-map (kbd "C-d") #'eshell-quit-or-delete-char) | 283 | (defun eshell-mode@setup () |
284 | (when (boundp 'simple-modeline--mode-line) | 284 | (define-key eshell-mode-map (kbd "C-d") |
285 | (setq mode-line-format '(:eval simple-modeline--mode-line))))) | 285 | #'eshell-quit-or-delete-char) |
286 | (when (boundp 'simple-modeline--mode-line) | ||
287 | (setq mode-line-format '(:eval simple-modeline--mode-line)))))) | ||
286 | 288 | ||
287 | (setup eww | 289 | (setup eww |
288 | (:option eww-search-prefix "https://duckduckgo.com/html?q=" | 290 | (:option eww-search-prefix "https://duckduckgo.com/html?q=" |
@@ -355,6 +357,8 @@ | |||
355 | (:option ibuffer-saved-filter-groups | 357 | (:option ibuffer-saved-filter-groups |
356 | '(("default" | 358 | '(("default" |
357 | ("dired" (mode . dired-mode)) | 359 | ("dired" (mode . dired-mode)) |
360 | ("elpher" (or (mode . elpher-mode) | ||
361 | (mode . gemini-mode))) | ||
358 | ("emacs" (or (name . "^\\*scratch\\*$") | 362 | ("emacs" (or (name . "^\\*scratch\\*$") |
359 | (name . "^\\*Messages\\*$"))) | 363 | (name . "^\\*Messages\\*$"))) |
360 | ("gnus" (or (mode . message-mode) | 364 | ("gnus" (or (mode . message-mode) |
@@ -423,9 +427,10 @@ | |||
423 | (setup prog | 427 | (setup prog |
424 | (:option smie-indent-basic tab-width) | 428 | (:option smie-indent-basic tab-width) |
425 | 429 | ||
426 | (hook-defun auto-fill-prog-mode prog-mode-hook | 430 | (add-hook 'prog-mode-hook |
427 | (setq-local comment-auto-fill-only-comments t) | 431 | (defun prog-mode@auto-fill () |
428 | (turn-on-auto-fill)) | 432 | (setq-local comment-auto-fill-only-comments t) |
433 | (turn-on-auto-fill))) | ||
429 | 434 | ||
430 | (:option show-paren-delay 0 | 435 | (:option show-paren-delay 0 |
431 | show-paren-style 'mixed | 436 | show-paren-style 'mixed |
@@ -531,11 +536,12 @@ | |||
531 | "Welcome to GNU Emacs.\n\n") | 536 | "Welcome to GNU Emacs.\n\n") |
532 | initial-major-mode 'emacs-lisp-mode) | 537 | initial-major-mode 'emacs-lisp-mode) |
533 | 538 | ||
534 | (hook-defun immortal-scratch kill-buffer-query-functions | 539 | (add-hook 'kill-buffer-query-functions |
535 | (if (eq (current-buffer) (get-buffer "*scratch*")) | 540 | (defun kill-buffer-query@immortal-scratch () |
536 | (progn (bury-buffer) | 541 | (if (eq (current-buffer) (get-buffer "*scratch*")) |
537 | nil) | 542 | (progn (bury-buffer) |
538 | t))) | 543 | nil) |
544 | t)))) | ||
539 | 545 | ||
540 | (setup scrolling | 546 | (setup scrolling |
541 | (:option auto-window-vscroll nil | 547 | (:option auto-window-vscroll nil |
@@ -678,14 +684,16 @@ | |||
678 | (apheleia-global-mode +1) | 684 | (apheleia-global-mode +1) |
679 | 685 | ||
680 | ;; Use a dumb formatter on modes that `apheleia' doesn't work for. | 686 | ;; Use a dumb formatter on modes that `apheleia' doesn't work for. |
681 | (hook-defun dumb-auto-format before-save-hook | 687 | (add-hook 'before-save-hook |
682 | (setq stupid-modes '(makefile-mode | 688 | (defun before-save@dumb-auto-format () |
683 | org-mode)) | 689 | (setq stupid-modes '(makefile-mode |
684 | ;; If there's no apheleia formatter for the mode, just indent the buffer. | 690 | org-mode)) |
685 | (unless (or (apply #'derived-mode-p stupid-modes) | 691 | ;; If there's no apheleia formatter for the mode, just indent the |
686 | (and (fboundp 'apheleia--get-formatter-command) | 692 | ;; buffer. |
687 | (apheleia--get-formatter-command))) | 693 | (unless (or (apply #'derived-mode-p stupid-modes) |
688 | (indent-region (point-min) (point-max))))) | 694 | (and (fboundp 'apheleia--get-formatter-command) |
695 | (apheleia--get-formatter-command))) | ||
696 | (indent-region (point-min) (point-max)))))) | ||
689 | 697 | ||
690 | (setup (:straight async) | 698 | (setup (:straight async) |
691 | (autoload 'dired-async-mode "dired-async.el" nil t) | 699 | (autoload 'dired-async-mode "dired-async.el" nil t) |
@@ -712,17 +720,17 @@ | |||
712 | :repo "minad/consult")) | 720 | :repo "minad/consult")) |
713 | 721 | ||
714 | ;; "Sensible" functions | 722 | ;; "Sensible" functions |
715 | (defun consult-sensible-grep () | 723 | (defun consult-sensible-grep (&optional arg) |
716 | "Perform `consult-git-grep' if in a git project, otherwise `consult-ripgrep' | 724 | "Perform `consult-git-grep' if in a git project, otherwise `consult-ripgrep' |
717 | if ripgrep is installed, otherwise `consult-grep'." | 725 | if ripgrep is installed, otherwise `consult-grep'." |
718 | (interactive "P") | 726 | (interactive "P") |
719 | (cond ((= (vc-backend buffer-file-name) "Git") | 727 | (cond ((string-equal (vc-backend buffer-file-name) "Git") |
720 | (call-interactively #'consult-git-grep)) | 728 | (call-interactively #'consult-git-grep)) |
721 | ((executable-find "rg") | 729 | ((executable-find "rg") |
722 | (call-interactively #'consult-ripgrep)) | 730 | (call-interactively #'consult-ripgrep)) |
723 | (t (call-interactively #'consult-grep)))) | 731 | (t (call-interactively #'consult-grep)))) |
724 | 732 | ||
725 | (defun consult-sensible-find () | 733 | (defun consult-sensible-find (&optional arg) |
726 | "Peform `consult-locate' if locate is installed, otehrwise `consult-find'." | 734 | "Peform `consult-locate' if locate is installed, otehrwise `consult-find'." |
727 | (interactive "P") | 735 | (interactive "P") |
728 | (cond ((executable-find "locate") (call-interactively #'consult-locate)) | 736 | (cond ((executable-find "locate") (call-interactively #'consult-locate)) |
@@ -833,9 +841,7 @@ if ripgrep is installed, otherwise `consult-grep'." | |||
833 | (setup (:straight (gemini-write | 841 | (setup (:straight (gemini-write |
834 | :host nil | 842 | :host nil |
835 | :repo "https://alexschroeder.ch/cgit/gemini-write" | 843 | :repo "https://alexschroeder.ch/cgit/gemini-write" |
836 | :fork | 844 | :branch "main")) |
837 | (:repo "https://tildegit.org/acdw/gemini-write" | ||
838 | :branch "main"))) | ||
839 | (require 'gemini-write)))) | 845 | (require 'gemini-write)))) |
840 | 846 | ||
841 | (setup (:straight expand-region) | 847 | (setup (:straight expand-region) |
@@ -943,7 +949,7 @@ if ripgrep is installed, otherwise `consult-grep'." | |||
943 | (:option org-adapt-indentation nil | 949 | (:option org-adapt-indentation nil |
944 | org-catch-invisible-edits 'smart | 950 | org-catch-invisible-edits 'smart |
945 | org-confirm-babel-evaluate nil | 951 | org-confirm-babel-evaluate nil |
946 | org-ellipsis " ⌵" | 952 | org-ellipsis " …" |
947 | org-export-coding-system 'utf-8-unix | 953 | org-export-coding-system 'utf-8-unix |
948 | org-export-headline-levels 8 | 954 | org-export-headline-levels 8 |
949 | org-export-with-section-numbers nil | 955 | org-export-with-section-numbers nil |
@@ -986,7 +992,9 @@ if ripgrep is installed, otherwise `consult-grep'." | |||
986 | (defun setup-paredit-mode () | 992 | (defun setup-paredit-mode () |
987 | "Correct weirdnesses and set up paredit mode." | 993 | "Correct weirdnesses and set up paredit mode." |
988 | (paredit-mode +1) | 994 | (paredit-mode +1) |
989 | (define-key lisp-mode-shared-map (kbd "DEL") #'paredit-backward-delete)) | 995 | (let ((map lisp-mode-shared-map)) |
996 | (define-key map (kbd "DEL") #'paredit-backward-delete) | ||
997 | (define-key map (kbd "C-M-;") #'comment-or-uncomment-sexp))) | ||
990 | 998 | ||
991 | (dolist (mode lispy-modes) | 999 | (dolist (mode lispy-modes) |
992 | (add-hook (intern (concat (symbol-name mode) "-hook")) | 1000 | (add-hook (intern (concat (symbol-name mode) "-hook")) |