summary refs log tree commit diff stats
path: root/init.el
diff options
context:
space:
mode:
authorCase Duckworth2021-10-07 18:24:23 -0500
committerCase Duckworth2021-10-07 18:24:23 -0500
commitbb5d048df691abbb0dde2b3174d4dcd91b466099 (patch)
tree7e0f77dfe48f177985d8e4c2d3ed0791708c60d6 /init.el
parentFix spacing (diff)
parentBreak spongebob-case to its own package (diff)
downloademacs-bb5d048df691abbb0dde2b3174d4dcd91b466099.tar.gz
emacs-bb5d048df691abbb0dde2b3174d4dcd91b466099.zip
Merge branch 'main' of github.com:duckwork/.emacs.d
Diffstat (limited to 'init.el')
-rw-r--r--init.el84
1 files changed, 73 insertions, 11 deletions
diff --git a/init.el b/init.el index b4790e0..d3ad238 100644 --- a/init.el +++ b/init.el
@@ -13,7 +13,9 @@
13;; Everyone is permitted to do whatever with this software, without 13;; Everyone is permitted to do whatever with this software, without
14;; limitation. This software comes without any warranty whatsoever, 14;; limitation. This software comes without any warranty whatsoever,
15;; but with two pieces of advice: 15;; but with two pieces of advice:
16
16;; - Be kind to yourself. 17;; - Be kind to yourself.
18
17;; - Make good choices. 19;; - Make good choices.
18 20
19;;; Commentary: 21;;; Commentary:
@@ -94,6 +96,38 @@
94 (expand-file-name-exists-p "pkg/" user-emacs-directory))) 96 (expand-file-name-exists-p "pkg/" user-emacs-directory)))
95 (normal-top-level-add-subdirs-to-load-path))) 97 (normal-top-level-add-subdirs-to-load-path)))
96 98
99(setup autoinsert
100 (require 'acdw-autoinsert)
101 (acdw/define-auto-insert '(:replace t)
102 ;; This is my custom auto-insert for elisp files.
103 '("\\.el\\'" . "Emacs Lisp header (acdw)")
104 '("Short description: " ";;; "
105 (file-name-nondirectory (buffer-file-name))
106 " --- " str
107 (make-string (max 2 ( - 80 (current-column) 27)) 32)
108 "-*- lexical-binding: t; -*-"
109 '(setq lexical-binding t)
110 "\n\n;; Copyright (C) " (format-time-string "%Y")
111 " " (getenv "ORGANIZATION") | (progn user-full-name)
112 "\n\n;; Author: " (user-full-name)
113 '(if (search-backward "&" (line-beginning-position) t)
114 (replace-match (capitalize (user-login-name)) t t))
115 '(end-of-line 1)
116 " <" (progn user-mail-address) ">"
117 & -2
118 "\n\n;;; License:"
119 "\n\n;; Everyone is permitted to do whatever with this software, without"
120 "\n;; limitation. This software comes without any warranty whatsoever,"
121 "\n;; but with two pieces of advice:"
122 "\n\n;; - Be kind to yourself."
123 "\n\n;; - Make good choices."
124 "\n\n;;; Commentary:"
125 "\n\n;; " _
126 "\n\n;;; Code:"
127 "\n\n\n\n(provide '" (file-name-base (buffer-file-name)) ")"
128 "\n;;; " (file-name-nondirectory (buffer-file-name)) " ends here\n"))
129 (auto-insert-mode +1))
130
97(setup autorevert 131(setup autorevert
98 (:option global-auto-revert-non-file-buffers t 132 (:option global-auto-revert-non-file-buffers t
99 auto-revert-verbose nil) 133 auto-revert-verbose nil)
@@ -397,8 +431,7 @@
397 (:bind "c" #'capitalize-dwim 431 (:bind "c" #'capitalize-dwim
398 "t" #'titlecase-dwim 432 "t" #'titlecase-dwim
399 "u" #'upcase-dwim 433 "u" #'upcase-dwim
400 "l" #'downcase-dwim 434 "l" #'downcase-dwim))
401 "s" #'spongebob-case-dwim))
402 435
403 (column-number-mode +1)) 436 (column-number-mode +1))
404 437
@@ -523,11 +556,10 @@
523 556
524 (defun list-string-match-p (string regexp-list) 557 (defun list-string-match-p (string regexp-list)
525 "Return t if at least one regex in RETGEXP-LIST matches STRING, else nil." 558 "Return t if at least one regex in RETGEXP-LIST matches STRING, else nil."
526 (when string ; if STRING is nil, return nil. 559 ;; FINE alphapapa ;P
527 (catch 'found 560 (seq-some (lambda (regexp)
528 (dolist (regexp regexp-list) 561 (string-match regexp string))
529 (when (string-match regexp string) 562 regexp-list))
530 (throw 'found t))))))
531 563
532 (defun flymake-unless () 564 (defun flymake-unless ()
533 "Turn on `flymake-mode', UNLESS it's inhibited. 565 "Turn on `flymake-mode', UNLESS it's inhibited.
@@ -1185,6 +1217,7 @@ specific to most general, they are these:
1185 scroll-margin 0 1217 scroll-margin 0
1186 word-wrap t 1218 word-wrap t
1187 wrap-prefix (repeat-string acdw-irc/left-margin " ") 1219 wrap-prefix (repeat-string acdw-irc/left-margin " ")
1220 nyan-mode nil
1188 line-number-mode nil 1221 line-number-mode nil
1189 column-number-mode nil 1222 column-number-mode nil
1190 file-percentage-mode nil) 1223 file-percentage-mode nil)
@@ -1298,6 +1331,23 @@ specific to most general, they are these:
1298 "C-M-\\" #'crux-cleanup-buffer-or-region 1331 "C-M-\\" #'crux-cleanup-buffer-or-region
1299 "C-x 4 t" #'crux-transpose-windows) 1332 "C-x 4 t" #'crux-transpose-windows)
1300 1333
1334 (el-patch-feature crux)
1335 (with-eval-after-load 'crux
1336 (el-patch-defun crux-reopen-as-root ()
1337 "Find file as root if necessary.
1338
1339Meant to be used as `find-file-hook'.
1340See also `crux-reopen-as-root-mode'."
1341 (unless (or
1342 ;; This helps fix for `nov-mode', and possibly others.
1343 (el-patch-add (null buffer-file-name))
1344 (tramp-tramp-file-p buffer-file-name)
1345 (equal major-mode 'dired-mode)
1346 (not (file-exists-p (file-name-directory buffer-file-name)))
1347 (file-writable-p buffer-file-name)
1348 (crux-file-owned-by-user-p buffer-file-name))
1349 (crux-find-alternate-file-as-root buffer-file-name))))
1350
1301 (crux-reopen-as-root-mode +1)) 1351 (crux-reopen-as-root-mode +1))
1302 1352
1303;; (setup (:straight-when 1353;; (setup (:straight-when
@@ -1906,7 +1956,13 @@ browser defined in `browse-url-secondary-browser-function'."
1906 (:option nyan-animate-nyancat nil 1956 (:option nyan-animate-nyancat nil
1907 nyan-bar-length 20 1957 nyan-bar-length 20
1908 nyan-minimum-window-width fill-column) 1958 nyan-minimum-window-width fill-column)
1909 (nyan-mode +1)) 1959 (nyan-mode +1)
1960 (defun disable-nyan-mode ()
1961 "Disable `nyan-mode' in current buffer."
1962 (setq-local nyan-mode -1))
1963 (dolist (mode '(eshell-mode
1964 comint-mode))
1965 (add-hook mode #'disable-nyan-mode)))
1910 1966
1911;; (setup (:straight olivetti) 1967;; (setup (:straight olivetti)
1912;; (:option olivetti-body-width (+ fill-column 4) 1968;; (:option olivetti-body-width (+ fill-column 4)
@@ -1927,7 +1983,8 @@ browser defined in `browse-url-secondary-browser-function'."
1927 orderless-component-separator #'orderless-escapable-split-on-space 1983 orderless-component-separator #'orderless-escapable-split-on-space
1928 orderless-matching-styles '(orderless-literal 1984 orderless-matching-styles '(orderless-literal
1929 orderless-regexp 1985 orderless-regexp
1930 orderless-flex) 1986 ;; orderless-flex
1987 )
1931 orderless-style-dispatchers '(acdw/orderless-dispatch)) 1988 orderless-style-dispatchers '(acdw/orderless-dispatch))
1932 1989
1933 (:advise orderless-regexp :filter-args 1990 (:advise orderless-regexp :filter-args
@@ -2032,7 +2089,7 @@ browser defined in `browse-url-secondary-browser-function'."
2032 org-src-window-setup 'current-window 2089 org-src-window-setup 'current-window
2033 org-startup-truncated nil 2090 org-startup-truncated nil
2034 org-startup-with-inline-images t 2091 org-startup-with-inline-images t
2035 org-tags-column (- fill-column)) 2092 org-tags-column (- (- fill-column (length org-ellipsis))))
2036 2093
2037 (:bind "RET" #'acdw-org/return-dwim 2094 (:bind "RET" #'acdw-org/return-dwim
2038 "<S-return>" #'acdw-org/org-table-copy-down 2095 "<S-return>" #'acdw-org/org-table-copy-down
@@ -2375,6 +2432,11 @@ the default is \"/\"."
2375 (:unbind "M-j" ; sp-join-sexp 2432 (:unbind "M-j" ; sp-join-sexp
2376 )) 2433 ))
2377 2434
2435(setup (:straight (spongebob-case
2436 :host github
2437 :repo "duckwork/spongebob-case.el"))
2438 (:global "C-c c s" #'spongebob-case-dwim))
2439
2378(setup (:straight ssh-config-mode) 2440(setup (:straight ssh-config-mode)
2379 (:file-match (rx "/.ssh/config" eos) 2441 (:file-match (rx "/.ssh/config" eos)
2380 (rx "/ssh" (? "d") "_config" eos)) 2442 (rx "/ssh" (? "d") "_config" eos))
@@ -2511,7 +2573,7 @@ If used with a numeric prefix argument N, N backticks will be inserted."
2511 (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)) 2573 (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy))
2512 2574
2513(setup (:straight visual-fill-column) 2575(setup (:straight visual-fill-column)
2514 (:option visual-fill-column-width (+ fill-column 4) 2576 (:option visual-fill-column-width fill-column
2515 visual-fill-column-center-text t 2577 visual-fill-column-center-text t
2516 (append reading-modes) '(visual-fill-column-mode . +1)) 2578 (append reading-modes) '(visual-fill-column-mode . +1))
2517 (:hook-into org-mode) 2579 (:hook-into org-mode)