From aebc5b6f76c187dc013f61d8ed5a65f8b97350b6 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 17 Jul 2023 22:58:17 -0500 Subject: meh --- emacs.el | 139 ++++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 102 insertions(+), 37 deletions(-) diff --git a/emacs.el b/emacs.el index 7e83277..a609f61 100644 --- a/emacs.el +++ b/emacs.el @@ -112,7 +112,9 @@ KEEP is also non-nil." (setopt inhibit-startup-screen t) (setopt initial-buffer-choice t) -(setopt initial-scratch-message ";; Emacs!\n\n") +(setopt initial-scratch-message + ;; ";; Emacs!\n\n" + nil) (setopt x-underline-at-descent-line t) (setopt blink-cursor-delay 0.25) @@ -147,7 +149,7 @@ KEEP is also non-nil." font-lock-bracket-face)) (face-spec-set face '((t :foreground unspecified :background unspecified)))) - (when-let ((current (cl-loop for modus in '(modus-vivendi modus-operandi) + (when-let ((current (cl-loop for modus in modus-themes-collection if (memq modus custom-enabled-themes) return modus finally return nil))) @@ -164,16 +166,19 @@ KEEP is also non-nil." ))) (advice-add 'load-theme :after #'reset-faces) -(load-theme 'modus-vivendi :no-confirm :no-enable) -(load-theme 'modus-operandi :no-confirm :no-enable) +(defvar dark-theme 'modus-vivendi-tinted) +(defvar light-theme 'modus-operandi-tinted) + +(load-theme dark-theme :no-confirm :no-enable) +(load-theme light-theme :no-confirm :no-enable) (if (and (executable-find "darkman") (let ((stat (shell-command "darkman get"))) (and (= stat 0) (equal (with-current-buffer shell-command-buffer-name (buffer-substring (point-min) (point-max))) "dark\n")))) - (load-theme 'modus-vivendi :no-confirm) - (load-theme 'modus-operandi :no-confirm)) + (load-theme dark-theme :no-confirm) + (load-theme light-theme :no-confirm)) (defun first-frame@set-fonts () @@ -231,6 +236,9 @@ KEEP is also non-nil." (run-after-init-or-first-frame #'first-frame@set-fonts) +(setopt frame-resize-pixelwise t) +(setopt window-resize-pixelwise t) + (defun tab-bar-end-space () `((end menu-item " " ignore))) @@ -253,6 +261,15 @@ KEEP is also non-nil." (when (package-ensure 'adaptive-wrap) (add-hook 'visual-line-mode-hook #'adaptive-wrap-prefix-mode)) +;;; Ediff + +(setopt ediff-split-window-function #'split-window-horizontally) +(setopt ediff-window-setup-function #'ediff-setup-windows-plain) + +;;; Man pages + +(setopt Man-notify-method 'aggressive) + ;;; Mode-line (defun hide-minor-mode (mode &optional hook) @@ -611,7 +628,7 @@ Good to use for :around advice." (when (package-ensure 'geiser) (when (executable-find "csi") (when (package-ensure 'geiser-chicken) - (setf/assoc auto-mode-alist "\\.egg\\'" 'scheme-mode)))) + (setf/assoc auto-mode-alist "\\.egg\\'" 'scheme-mode))) (setopt scheme-program-name (or (executable-find "csi") "scheme")) (add-hook 'scheme-mode-hook #'geiser-mode)) @@ -634,9 +651,10 @@ Good to use for :around advice." (keymap-set lisp-interaction-mode-map "C-c C-b" #'eval-buffer) (keymap-set lisp-interaction-mode-map "C-c C-z" #'ielm) ; TODO: better-ize - -(define-advice eval-buffer (:after (&rest _) message) - (message "Buffer %s evaluated." (current-buffer))) +(add-hook 'after-init-hook + (lambda () + (define-advice eval-buffer (:after (&rest _) message) + (message "Buffer %s evaluated." (current-buffer))))) ;;; Files @@ -712,6 +730,8 @@ Good to use for :around advice." ;;; ... +(setopt bookmark-save-flag 1) + (defun c-w-dwim (num) "Delete NUM words backward, or the region if it's active." (interactive "p") @@ -1363,6 +1383,9 @@ the following: `:keys', `:description', `:type', `:target', and (with-eval-after-load 'dired (keymap-set dired-mode-map "C-j" #'dired-up-directory)) +(setopt dired-auto-revert-buffer t) +(setopt dired-dwim-target t) ; dired-dwim-target-next ? + ;;; Browsing the web @@ -1543,6 +1566,7 @@ the following: `:keys', `:description', `:type', `:target', and eshell-pred eshell-prompt eshell-script + eshell-smart eshell-unix)) (setopt eshell-banner-message "") @@ -1567,6 +1591,7 @@ the following: `:keys', `:description', `:type', `:target', and (if (= (user-uid) 0) " # " " $ ")))) +(setopt eshell-scroll-to-bottom-on-input 'this) (add-hook 'eshell-mode-hook (defun eshell-setup () @@ -1578,41 +1603,47 @@ the following: `:keys', `:description', `:type', `:target', and (setenv "PAGER" (executable-find "cat")) -(defun eshellp (buffer-or-name) - (with-current-buffer buffer-or-name - (derived-mode-p 'eshell-mode))) - -(defun eshell-pop-up (&optional arg) - "Pop up an eshell in the `default-directory'. -NEW is passed to `eshell'." - (interactive "P") - (require 'eshell) - (let ((dir default-directory) - (display-comint-buffer-action 'pop-to-buffer)) - (if-let ((buf (and (not arg) - (or (get-buffer eshell-buffer-name) - (seq-find #'eshellp (reverse (buffer-list))))))) - (pop-to-buffer buf) - (eshell arg)) - ;; In the eshell buffer - (unless (file-equal-p default-directory dir) - (eshell/cd dir) - (eshell-send-input) - (goto-char (point-max))))) - -(keymap-global-set "C-z" #'eshell-pop-up) -(with-eval-after-load 'esh-mode - (keymap-set eshell-mode-map "C-z" #'quit-window)) +(setopt eshell-where-to-jump 'begin) +(setopt eshell-review-quick-commands nil) +(setopt eshell-smart-space-goes-to-end t) (when (package-ensure 'eat) (add-hook 'eshell-first-time-mode-hook #'eat-eshell-mode) (with-eval-after-load 'eat (keymap-unset eat-eshell-semi-char-mode-map "M-o" t))) +(if (package-ensure 'eshell-toggle) + (keymap-global-set "C-z" #'eshell-toggle) + ;; If the package doesn't load for some reason, do the dumb thing instead + (defun eshellp (buffer-or-name) + (with-current-buffer buffer-or-name + (derived-mode-p 'eshell-mode))) + + (defun eshell-pop-up (&optional arg) + "Pop up an eshell in the `default-directory'. +NEW is passed to `eshell'." + (interactive "P") + (require 'eshell) + (let ((dir default-directory) + (display-comint-buffer-action 'pop-to-buffer)) + (if-let ((buf (and (not arg) + (or (get-buffer eshell-buffer-name) + (seq-find #'eshellp (reverse (buffer-list))))))) + (pop-to-buffer buf) + (eshell arg)) + ;; In the eshell buffer + (unless (file-equal-p default-directory dir) + (eshell/cd dir) + (eshell-send-input) + (goto-char (point-max))))) + + (keymap-global-set "C-z" #'eshell-pop-up) + (with-eval-after-load 'esh-mode + (keymap-set eshell-mode-map "C-z" #'quit-window))) + (when (package-ensure 'wiki-abbrev t) (wiki-abbrev-insinuate) (add-hook 'text-mode-hook #'abbrev-mode)) -(put 'list-timers 'disabled nil) ;;; Dinghie @@ -1664,6 +1695,13 @@ NEW is passed to `eshell'." (apply #'derived-mode-p modes)) (funcall fn))))) +(defun mapc-buffers/progress (msg fn &rest modes) + (dolist-with-progress-reporter (buf (buffer-list)) msg + (with-current-buffer buf + (when (or (null modes) + (apply #'derived-mode-p modes)) + (funcall fn))))) + ;;; Flash! (defun flash-region@ (orig start end &rest args) @@ -1728,8 +1766,22 @@ NEW is passed to `eshell'." (defun enable-rcirc-track-minor-mode (&rest _) (rcirc-track-minor-mode 1))) + (defun rcirc-kill () + "Kill all rcirc buffers and turn off `rcirc-track-minor-mode'." + (interactive) + (mapc-buffers/progress "Killing rcirc buffers..." + (lambda () + (let ((kill-buffer-hook)) + (kill-buffer))) + 'rcirc-mode) + (rcirc-track-minor-mode -1)) + (add-hook 'rcirc-mode-hook #'chat/setup) (add-hook 'rcirc-mode-hook #'rcirc-omit-mode) + (add-hook 'rcirc-track-minor-mode-hook + (defun rcirc-track@buffer-list-change () + (add-hook 'buffer-list-update-hook + #'rcirc-window-configuration-change))) ;; "Fix" some things (setf rcirc-implemented-capabilities @@ -1810,7 +1862,10 @@ TODO: fully document" (advice-add 'rcirc :before #'rcirc-resolve-passwords) (defun rcirc/password (&rest spec) - (lambda () (auth-info-password (car (apply #'auth-source-search spec))))) + (lambda () + (auth-info-password + (car + (apply #'auth-source-search spec))))) (setq rcirc-server-alist nil) @@ -1846,3 +1901,13 @@ TODO: fully document" :password (rcirc/password :host "libera.chat" :user "acdw")) ;; End of rcirc configuration. ) + +(when (package-ensure 'web-mode) + (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) + (add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode)) + (add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode)) + (add-to-list 'auto-mode-alist '("\\. [agj]sp\\'" . web-mode)) + (add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode)) + (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode)) + (add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode)) + (add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))) -- cgit 1.4.1-21-gabe81