about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2023-07-17 22:58:17 -0500
committerCase Duckworth2023-07-17 22:58:17 -0500
commitaebc5b6f76c187dc013f61d8ed5a65f8b97350b6 (patch)
treed49ac154e32c1b0702e54c2ca948b859a291334d
parentnyahhhhh ~~~~~~ (diff)
downloadetc-aebc5b6f76c187dc013f61d8ed5a65f8b97350b6.tar.gz
etc-aebc5b6f76c187dc013f61d8ed5a65f8b97350b6.zip
meh
-rw-r--r--emacs.el139
1 files 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."
112 112
113(setopt inhibit-startup-screen t) 113(setopt inhibit-startup-screen t)
114(setopt initial-buffer-choice t) 114(setopt initial-buffer-choice t)
115(setopt initial-scratch-message ";; Emacs!\n\n") 115(setopt initial-scratch-message
116 ;; ";; Emacs!\n\n"
117 nil)
116 118
117(setopt x-underline-at-descent-line t) 119(setopt x-underline-at-descent-line t)
118(setopt blink-cursor-delay 0.25) 120(setopt blink-cursor-delay 0.25)
@@ -147,7 +149,7 @@ KEEP is also non-nil."
147 font-lock-bracket-face)) 149 font-lock-bracket-face))
148 (face-spec-set face '((t :foreground unspecified 150 (face-spec-set face '((t :foreground unspecified
149 :background unspecified)))) 151 :background unspecified))))
150 (when-let ((current (cl-loop for modus in '(modus-vivendi modus-operandi) 152 (when-let ((current (cl-loop for modus in modus-themes-collection
151 if (memq modus custom-enabled-themes) 153 if (memq modus custom-enabled-themes)
152 return modus 154 return modus
153 finally return nil))) 155 finally return nil)))
@@ -164,16 +166,19 @@ KEEP is also non-nil."
164 ))) 166 )))
165(advice-add 'load-theme :after #'reset-faces) 167(advice-add 'load-theme :after #'reset-faces)
166 168
167(load-theme 'modus-vivendi :no-confirm :no-enable) 169(defvar dark-theme 'modus-vivendi-tinted)
168(load-theme 'modus-operandi :no-confirm :no-enable) 170(defvar light-theme 'modus-operandi-tinted)
171
172(load-theme dark-theme :no-confirm :no-enable)
173(load-theme light-theme :no-confirm :no-enable)
169(if (and (executable-find "darkman") 174(if (and (executable-find "darkman")
170 (let ((stat (shell-command "darkman get"))) 175 (let ((stat (shell-command "darkman get")))
171 (and (= stat 0) 176 (and (= stat 0)
172 (equal (with-current-buffer shell-command-buffer-name 177 (equal (with-current-buffer shell-command-buffer-name
173 (buffer-substring (point-min) (point-max))) 178 (buffer-substring (point-min) (point-max)))
174 "dark\n")))) 179 "dark\n"))))
175 (load-theme 'modus-vivendi :no-confirm) 180 (load-theme dark-theme :no-confirm)
176 (load-theme 'modus-operandi :no-confirm)) 181 (load-theme light-theme :no-confirm))
177 182
178 183
179(defun first-frame@set-fonts () 184(defun first-frame@set-fonts ()
@@ -231,6 +236,9 @@ KEEP is also non-nil."
231 236
232(run-after-init-or-first-frame #'first-frame@set-fonts) 237(run-after-init-or-first-frame #'first-frame@set-fonts)
233 238
239(setopt frame-resize-pixelwise t)
240(setopt window-resize-pixelwise t)
241
234(defun tab-bar-end-space () 242(defun tab-bar-end-space ()
235 `((end menu-item " " ignore))) 243 `((end menu-item " " ignore)))
236 244
@@ -253,6 +261,15 @@ KEEP is also non-nil."
253(when (package-ensure 'adaptive-wrap) 261(when (package-ensure 'adaptive-wrap)
254 (add-hook 'visual-line-mode-hook #'adaptive-wrap-prefix-mode)) 262 (add-hook 'visual-line-mode-hook #'adaptive-wrap-prefix-mode))
255 263
264;;; Ediff
265
266(setopt ediff-split-window-function #'split-window-horizontally)
267(setopt ediff-window-setup-function #'ediff-setup-windows-plain)
268
269;;; Man pages
270
271(setopt Man-notify-method 'aggressive)
272
256;;; Mode-line 273;;; Mode-line
257 274
258(defun hide-minor-mode (mode &optional hook) 275(defun hide-minor-mode (mode &optional hook)
@@ -611,7 +628,7 @@ Good to use for :around advice."
611(when (package-ensure 'geiser) 628(when (package-ensure 'geiser)
612 (when (executable-find "csi") 629 (when (executable-find "csi")
613 (when (package-ensure 'geiser-chicken) 630 (when (package-ensure 'geiser-chicken)
614 (setf/assoc auto-mode-alist "\\.egg\\'" 'scheme-mode)))) 631 (setf/assoc auto-mode-alist "\\.egg\\'" 'scheme-mode)))
615 (setopt scheme-program-name (or (executable-find "csi") 632 (setopt scheme-program-name (or (executable-find "csi")
616 "scheme")) 633 "scheme"))
617 (add-hook 'scheme-mode-hook #'geiser-mode)) 634 (add-hook 'scheme-mode-hook #'geiser-mode))
@@ -634,9 +651,10 @@ Good to use for :around advice."
634(keymap-set lisp-interaction-mode-map "C-c C-b" #'eval-buffer) 651(keymap-set lisp-interaction-mode-map "C-c C-b" #'eval-buffer)
635(keymap-set lisp-interaction-mode-map "C-c C-z" #'ielm) ; TODO: better-ize 652(keymap-set lisp-interaction-mode-map "C-c C-z" #'ielm) ; TODO: better-ize
636 653
637 654(add-hook 'after-init-hook
638(define-advice eval-buffer (:after (&rest _) message) 655 (lambda ()
639 (message "Buffer %s evaluated." (current-buffer))) 656 (define-advice eval-buffer (:after (&rest _) message)
657 (message "Buffer %s evaluated." (current-buffer)))))
640 658
641 659
642;;; Files 660;;; Files
@@ -712,6 +730,8 @@ Good to use for :around advice."
712 730
713;;; ... 731;;; ...
714 732
733(setopt bookmark-save-flag 1)
734
715(defun c-w-dwim (num) 735(defun c-w-dwim (num)
716 "Delete NUM words backward, or the region if it's active." 736 "Delete NUM words backward, or the region if it's active."
717 (interactive "p") 737 (interactive "p")
@@ -1363,6 +1383,9 @@ the following: `:keys', `:description', `:type', `:target', and
1363(with-eval-after-load 'dired 1383(with-eval-after-load 'dired
1364 (keymap-set dired-mode-map "C-j" #'dired-up-directory)) 1384 (keymap-set dired-mode-map "C-j" #'dired-up-directory))
1365 1385
1386(setopt dired-auto-revert-buffer t)
1387(setopt dired-dwim-target t) ; dired-dwim-target-next ?
1388
1366 1389
1367;;; Browsing the web 1390;;; Browsing the web
1368 1391
@@ -1543,6 +1566,7 @@ the following: `:keys', `:description', `:type', `:target', and
1543 eshell-pred 1566 eshell-pred
1544 eshell-prompt 1567 eshell-prompt
1545 eshell-script 1568 eshell-script
1569 eshell-smart
1546 eshell-unix)) 1570 eshell-unix))
1547 1571
1548(setopt eshell-banner-message "") 1572(setopt eshell-banner-message "")
@@ -1567,6 +1591,7 @@ the following: `:keys', `:description', `:type', `:target', and
1567 (if (= (user-uid) 0) 1591 (if (= (user-uid) 0)
1568 " # " 1592 " # "
1569 " $ ")))) 1593 " $ "))))
1594(setopt eshell-scroll-to-bottom-on-input 'this)
1570 1595
1571(add-hook 'eshell-mode-hook 1596(add-hook 'eshell-mode-hook
1572 (defun eshell-setup () 1597 (defun eshell-setup ()
@@ -1578,41 +1603,47 @@ the following: `:keys', `:description', `:type', `:target', and
1578 1603
1579(setenv "PAGER" (executable-find "cat")) 1604(setenv "PAGER" (executable-find "cat"))
1580 1605
1581(defun eshellp (buffer-or-name) 1606(setopt eshell-where-to-jump 'begin)
1582 (with-current-buffer buffer-or-name 1607(setopt eshell-review-quick-commands nil)
1583 (derived-mode-p 'eshell-mode))) 1608(setopt eshell-smart-space-goes-to-end t)
1584
1585(defun eshell-pop-up (&optional arg)
1586 "Pop up an eshell in the `default-directory'.
1587NEW is passed to `eshell'."
1588 (interactive "P")
1589 (require 'eshell)
1590 (let ((dir default-directory)
1591 (display-comint-buffer-action 'pop-to-buffer))
1592 (if-let ((buf (and (not arg)
1593 (or (get-buffer eshell-buffer-name)
1594 (seq-find #'eshellp (reverse (buffer-list)))))))
1595 (pop-to-buffer buf)
1596 (eshell arg))
1597 ;; In the eshell buffer
1598 (unless (file-equal-p default-directory dir)
1599 (eshell/cd dir)
1600 (eshell-send-input)
1601 (goto-char (point-max)))))
1602
1603(keymap-global-set "C-z" #'eshell-pop-up)
1604(with-eval-after-load 'esh-mode
1605 (keymap-set eshell-mode-map "C-z" #'quit-window))
1606 1609
1607(when (package-ensure 'eat) 1610(when (package-ensure 'eat)
1608 (add-hook 'eshell-first-time-mode-hook #'eat-eshell-mode) 1611 (add-hook 'eshell-first-time-mode-hook #'eat-eshell-mode)
1609 (with-eval-after-load 'eat 1612 (with-eval-after-load 'eat
1610 (keymap-unset eat-eshell-semi-char-mode-map "M-o" t))) 1613 (keymap-unset eat-eshell-semi-char-mode-map "M-o" t)))
1611 1614
1615(if (package-ensure 'eshell-toggle)
1616 (keymap-global-set "C-z" #'eshell-toggle)
1617 ;; If the package doesn't load for some reason, do the dumb thing instead
1618 (defun eshellp (buffer-or-name)
1619 (with-current-buffer buffer-or-name
1620 (derived-mode-p 'eshell-mode)))
1621
1622 (defun eshell-pop-up (&optional arg)
1623 "Pop up an eshell in the `default-directory'.
1624NEW is passed to `eshell'."
1625 (interactive "P")
1626 (require 'eshell)
1627 (let ((dir default-directory)
1628 (display-comint-buffer-action 'pop-to-buffer))
1629 (if-let ((buf (and (not arg)
1630 (or (get-buffer eshell-buffer-name)
1631 (seq-find #'eshellp (reverse (buffer-list)))))))
1632 (pop-to-buffer buf)
1633 (eshell arg))
1634 ;; In the eshell buffer
1635 (unless (file-equal-p default-directory dir)
1636 (eshell/cd dir)
1637 (eshell-send-input)
1638 (goto-char (point-max)))))
1639
1640 (keymap-global-set "C-z" #'eshell-pop-up)
1641 (with-eval-after-load 'esh-mode
1642 (keymap-set eshell-mode-map "C-z" #'quit-window)))
1643
1612(when (package-ensure 'wiki-abbrev t) 1644(when (package-ensure 'wiki-abbrev t)
1613 (wiki-abbrev-insinuate) 1645 (wiki-abbrev-insinuate)
1614 (add-hook 'text-mode-hook #'abbrev-mode)) 1646 (add-hook 'text-mode-hook #'abbrev-mode))
1615(put 'list-timers 'disabled nil)
1616 1647
1617;;; Dinghie 1648;;; Dinghie
1618 1649
@@ -1664,6 +1695,13 @@ NEW is passed to `eshell'."
1664 (apply #'derived-mode-p modes)) 1695 (apply #'derived-mode-p modes))
1665 (funcall fn))))) 1696 (funcall fn)))))
1666 1697
1698(defun mapc-buffers/progress (msg fn &rest modes)
1699 (dolist-with-progress-reporter (buf (buffer-list)) msg
1700 (with-current-buffer buf
1701 (when (or (null modes)
1702 (apply #'derived-mode-p modes))
1703 (funcall fn)))))
1704
1667;;; Flash! 1705;;; Flash!
1668 1706
1669(defun flash-region@ (orig start end &rest args) 1707(defun flash-region@ (orig start end &rest args)
@@ -1728,8 +1766,22 @@ NEW is passed to `eshell'."
1728 (defun enable-rcirc-track-minor-mode (&rest _) 1766 (defun enable-rcirc-track-minor-mode (&rest _)
1729 (rcirc-track-minor-mode 1))) 1767 (rcirc-track-minor-mode 1)))
1730 1768
1769 (defun rcirc-kill ()
1770 "Kill all rcirc buffers and turn off `rcirc-track-minor-mode'."
1771 (interactive)
1772 (mapc-buffers/progress "Killing rcirc buffers..."
1773 (lambda ()
1774 (let ((kill-buffer-hook))
1775 (kill-buffer)))
1776 'rcirc-mode)
1777 (rcirc-track-minor-mode -1))
1778
1731 (add-hook 'rcirc-mode-hook #'chat/setup) 1779 (add-hook 'rcirc-mode-hook #'chat/setup)
1732 (add-hook 'rcirc-mode-hook #'rcirc-omit-mode) 1780 (add-hook 'rcirc-mode-hook #'rcirc-omit-mode)
1781 (add-hook 'rcirc-track-minor-mode-hook
1782 (defun rcirc-track@buffer-list-change ()
1783 (add-hook 'buffer-list-update-hook
1784 #'rcirc-window-configuration-change)))
1733 1785
1734 ;; "Fix" some things 1786 ;; "Fix" some things
1735 (setf rcirc-implemented-capabilities 1787 (setf rcirc-implemented-capabilities
@@ -1810,7 +1862,10 @@ TODO: fully document"
1810 (advice-add 'rcirc :before #'rcirc-resolve-passwords) 1862 (advice-add 'rcirc :before #'rcirc-resolve-passwords)
1811 1863
1812 (defun rcirc/password (&rest spec) 1864 (defun rcirc/password (&rest spec)
1813 (lambda () (auth-info-password (car (apply #'auth-source-search spec))))) 1865 (lambda ()
1866 (auth-info-password
1867 (car
1868 (apply #'auth-source-search spec)))))
1814 1869
1815 (setq rcirc-server-alist nil) 1870 (setq rcirc-server-alist nil)
1816 1871
@@ -1846,3 +1901,13 @@ TODO: fully document"
1846 :password (rcirc/password :host "libera.chat" :user "acdw")) 1901 :password (rcirc/password :host "libera.chat" :user "acdw"))
1847 ;; End of rcirc configuration. 1902 ;; End of rcirc configuration.
1848 ) 1903 )
1904
1905(when (package-ensure 'web-mode)
1906 (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
1907 (add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
1908 (add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
1909 (add-to-list 'auto-mode-alist '("\\. [agj]sp\\'" . web-mode))
1910 (add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
1911 (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
1912 (add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
1913 (add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode)))