diff options
-rw-r--r-- | TODO.org | 92 | ||||
-rw-r--r-- | init.el | 226 | ||||
-rw-r--r-- | lisp/acdw-modeline.el | 2 | ||||
-rw-r--r-- | lisp/acdw-setup.el | 3 | ||||
-rw-r--r-- | lisp/acdw-ytel.el | 44 | ||||
-rw-r--r-- | lisp/acdw.el | 28 |
6 files changed, 231 insertions, 164 deletions
diff --git a/TODO.org b/TODO.org index 358320b..081ba03 100644 --- a/TODO.org +++ b/TODO.org | |||
@@ -99,36 +99,25 @@ e.g., “A gold watch” title-cases to “A gold Watch” | |||
99 | *** Inspo: From wsinatra | 99 | *** Inspo: From wsinatra |
100 | 100 | ||
101 | #+begin_src emacs-lisp | 101 | #+begin_src emacs-lisp |
102 | ;; Custom capture templates | 102 | ;; Custom capture templates (setq org-capture-templates '(("t" "Todo" entry |
103 | (setq org-capture-templates | 103 | (file org-default-notes-file) "* TODO %?\n%u\n%a\n" :clock-in t :clock-resume |
104 | '(("t" "Todo" entry (file org-default-notes-file) | 104 | t) ("e" "Event" entry (file org-default-notes-file) "* EVENT %? :EVENT:\n%t" |
105 | "* TODO %?\n%u\n%a\n" :clock-in t :clock-resume t) | 105 | :clock-in t :clock-resume t) ("i" "Idea" entry (file org-default-notes-file) |
106 | ("e" "Event" entry (file org-default-notes-file) | 106 | "* %? :IDEA: \n%t" :clock-in t :clock-resume t) ("p" "Project" entry (file |
107 | "* EVENT %? :EVENT:\n%t" :clock-in t :clock-resume t) | 107 | org-default-notes-file) "* PROJ %?\n%u\n%a\n" :clock-in t :clock-resume t) |
108 | ("i" "Idea" entry (file org-default-notes-file) | 108 | ("n" "Next Task" entry (file+headline org-default-notes-file "Tasks") "** |
109 | "* %? :IDEA: \n%t" :clock-in t :clock-resume t) | 109 | NEXT %? \nDEADLINE: %t"))) #+end_src |
110 | ("p" "Project" entry (file org-default-notes-file) | ||
111 | "* PROJ %?\n%u\n%a\n" :clock-in t :clock-resume t) | ||
112 | ("n" "Next Task" entry (file+headline | ||
113 | org-default-notes-file "Tasks") | ||
114 | "** NEXT %? \nDEADLINE: %t"))) | ||
115 | #+end_src | ||
116 | 110 | ||
117 | *** Also cf. [[https://blog.jethro.dev/posts/org_mode_workflow_preview/][Org-mode Workflow: A Preview · Jethro Kuan]] | 111 | *** Also cf. [[https://blog.jethro.dev/posts/org_mode_workflow_preview/][Org-mode Workflow: A Preview · Jethro Kuan]] |
118 | 112 | ||
119 | * Buffer display stuff | 113 | * Buffer display stuff |
120 | 114 | ||
121 | #+begin_src emacs-lisp | 115 | #+begin_src emacs-lisp |
122 | ;; from alphapapa | 116 | ;; from alphapapa (cl-defun ap/display-buffer-in-side-window (&optional |
123 | (cl-defun ap/display-buffer-in-side-window (&optional (buffer (current-buffer))) | 117 | (buffer (current-buffer))) "Display BUFFER in dedicated side window." |
124 | "Display BUFFER in dedicated side window." | 118 | (interactive) (let ((display-buffer-mark-dedicated t)) |
125 | (interactive) | 119 | (display-buffer-in-side-window buffer '((side . right) (window-parameters |
126 | (let ((display-buffer-mark-dedicated t)) | 120 | (no-delete-other-windows . t)))))) #+end_src |
127 | (display-buffer-in-side-window buffer | ||
128 | '((side . right) | ||
129 | (window-parameters | ||
130 | (no-delete-other-windows . t)))))) | ||
131 | #+end_src | ||
132 | 121 | ||
133 | - [[https://old.reddit.com/r/emacs/comments/pka1sm/my_first_package_aside_for_easier_configuration/][My first package: Aside, for easier configuration and use of side windows : | 122 | - [[https://old.reddit.com/r/emacs/comments/pka1sm/my_first_package_aside_for_easier_configuration/][My first package: Aside, for easier configuration and use of side windows : |
134 | emacs]] | 123 | emacs]] |
@@ -148,43 +137,30 @@ e.g., “A gold watch” title-cases to “A gold Watch” | |||
148 | ** A way to map over buffers | 137 | ** A way to map over buffers |
149 | 138 | ||
150 | #+begin_src emacs-lisp | 139 | #+begin_src emacs-lisp |
151 | (dolist (buf (mapcan (lambda (buf) | 140 | (dolist (buf (mapcan (lambda (buf) (with-current-buffer buf |
152 | (with-current-buffer buf | 141 | (circe-server-chat-buffers))) (circe-server-buffers))) |
153 | (circe-server-chat-buffers))) | 142 | (with-current-buffer buf ;; whatever u wanna do on |
154 | (circe-server-buffers))) | 143 | each buffer goes here (lui-set-prompt (concat |
155 | (with-current-buffer buf | 144 | (propertize (acdw-irc/margin-format (buffer-name) "" |
156 | ;; whatever u wanna do on each buffer goes here | 145 | ">") 'face 'circe-prompt-face 'read-only t 'intangible |
157 | (lui-set-prompt | 146 | t 'cursor-intangible t) " ")) (setq-local |
158 | (concat (propertize (acdw-irc/margin-format (buffer-name) | 147 | fringes-outside-margins t right-margin-width 5 |
159 | "" | 148 | scroll-margin 0 word-wrap t wrap-prefix (repeat-string |
160 | ">") | 149 | acdw-irc/left-margin " ") line-number-mode nil))) |
161 | 'face 'circe-prompt-face | 150 | #+end_src |
162 | 'read-only t 'intangible t | ||
163 | 'cursor-intangible t) | ||
164 | " ")) | ||
165 | (setq-local fringes-outside-margins t | ||
166 | right-margin-width 5 | ||
167 | scroll-margin 0 | ||
168 | word-wrap t | ||
169 | wrap-prefix (repeat-string | ||
170 | acdw-irc/left-margin " ") | ||
171 | line-number-mode nil))) | ||
172 | #+end_src | ||
173 | 151 | ||
174 | ** ZNC Connecting (from #systemcrafters) | 152 | ** ZNC Connecting (from #systemcrafters) |
175 | 153 | ||
176 | #+begin_quote | 154 | #+begin_quote |
177 | daviwil | minikN: I connect to the hostname/port of my ZNC server, | 155 | daviwil | minikN: I connect to the hostname/port of my ZNC server, but the |
178 | but the trick is that the username is the nick you want to | 156 | trick is that the username is the nick you want to use on the |
179 | use on the server and the password is your znc username | 157 | server and the password is your znc username and password joined |
180 | and password joined with a colon, like daviwil:b4dp4ssw0rd | 158 | with a colon, like daviwil:b4dp4ssw0rd minikN | so you don't |
181 | minikN | so you don't specify the network in your password? like | 159 | specify the network in your password? like user/network:password? |
182 | user/network:password? | 160 | benoitj | daviwil: nice password you have there daviwil | minikN: |
183 | benoitj | daviwil: nice password you have there | 161 | nope, I only have one network anyway |
184 | daviwil | minikN: nope, I only have one network anyway | ||
185 | - acdw > daviwil: I just see ******* | 162 | - acdw > daviwil: I just see ******* |
186 | benoitj | I use two networks | 163 | benoitj | I use two networks #+end_quote |
187 | #+end_quote | ||
188 | 164 | ||
189 | ** Teach =link-hint= about =lui-buttons= | 165 | ** Teach =link-hint= about =lui-buttons= |
190 | 166 | ||
@@ -204,6 +180,8 @@ https://tildegit.org/acdw/emacs/src/branch/main/init.el#L1166, e.g. | |||
204 | 180 | ||
205 | - *OR* install this: [[https://github.com/sshaw/git-link][GitHub - sshaw/git-link: Emacs package to get the GitHub/Bitbucket/GitLab/... URL for a buffer location]] | 181 | - *OR* install this: [[https://github.com/sshaw/git-link][GitHub - sshaw/git-link: Emacs package to get the GitHub/Bitbucket/GitLab/... URL for a buffer location]] |
206 | 182 | ||
207 | ** Fix =acdw-org/count-words-stupidly= | 183 | ** DONE Fix =acdw-org/count-words-stupidly= |
208 | 184 | ||
209 | It adds one for blank lines. | 185 | It adds one for blank lines. |
186 | |||
187 | ** TODO [[https://stackoverflow.com/questions/25161792/emacs-org-mode-how-can-i-fold-everything-but-the-current-headline][Org mode hide all but current heading]] | ||
diff --git a/init.el b/init.el index 99270af..a598b16 100644 --- a/init.el +++ b/init.el | |||
@@ -386,16 +386,12 @@ | |||
386 | 386 | ||
387 | (:with-map case-map | 387 | (:with-map case-map |
388 | (require 'titlecase) | 388 | (require 'titlecase) |
389 | (require 'acdw) | ||
389 | (:bind "c" #'capitalize-dwim | 390 | (:bind "c" #'capitalize-dwim |
390 | "t" #'titlecase-dwim | 391 | "t" #'titlecase-dwim |
391 | "u" #'upcase-dwim | 392 | "u" #'upcase-dwim |
392 | "l" #'downcase-dwim | 393 | "l" #'downcase-dwim |
393 | "s" (defun studlify-dwim (count) | 394 | "s" #'spongebob-case-dwim)) |
394 | "Studlify region if active, or COUNT words if not." | ||
395 | (interactive "*p") | ||
396 | (if (region-active-p) | ||
397 | (studlify-region (region-beginning) (region-end)) | ||
398 | (studlify-word count))))) | ||
399 | 395 | ||
400 | (column-number-mode +1)) | 396 | (column-number-mode +1)) |
401 | 397 | ||
@@ -680,7 +676,7 @@ specific to most general, they are these: | |||
680 | (:option mouse-1-click-follows-link t)) | 676 | (:option mouse-1-click-follows-link t)) |
681 | 677 | ||
682 | (setup mouse-avoidance | 678 | (setup mouse-avoidance |
683 | (mouse-avoidance-mode 'exile)) | 679 | (mouse-avoidance-mode 'banish)) |
684 | 680 | ||
685 | (setup page | 681 | (setup page |
686 | (:option page-delimiter | 682 | (:option page-delimiter |
@@ -728,19 +724,20 @@ specific to most general, they are these: | |||
728 | (turn-on-auto-fill)))) | 724 | (turn-on-auto-fill)))) |
729 | 725 | ||
730 | (setup pulse | 726 | (setup pulse |
731 | (:option pulse-flag t | 727 | (:option pulse-flag nil |
732 | pulse-delay 0.5 | 728 | pulse-delay 0.5 |
733 | pulse-iterations 1) | 729 | pulse-iterations 1) |
734 | 730 | ||
735 | (defun pulse-line (&rest _) | 731 | (defun pulse-line (&rest _) |
736 | "Pulse the current line." | 732 | "Pulse the current line." |
737 | (pulse-momentary-highlight-one-line (point))) | 733 | (pulse-momentary-highlight-one-line (point))) |
738 | 734 | ||
739 | (dolist (command '(scroll-up-command | 735 | (dolist (func '(scroll-up-command |
740 | scroll-down-command | 736 | scroll-down-command |
741 | recenter-top-bottom other-window | 737 | recenter-top-bottom other-window |
742 | switch-to-buffer)) | 738 | switch-to-buffer |
743 | (advice-add command :after #'pulse-line))) | 739 | redraw-frame)) |
740 | (advice-add func :after #'pulse-line))) | ||
744 | 741 | ||
745 | (setup re-builder | 742 | (setup re-builder |
746 | (require 'acdw-re) | 743 | (require 'acdw-re) |
@@ -972,18 +969,18 @@ specific to most general, they are these: | |||
972 | :repo "willvaughn/emacs-0x0")) | 969 | :repo "willvaughn/emacs-0x0")) |
973 | (:option 0x0-default-server 'ttm)) | 970 | (:option 0x0-default-server 'ttm)) |
974 | 971 | ||
975 | (setup (:straight-if affe | 972 | (setup (:straight-when affe |
976 | (and (or (executable-find "fd") | 973 | (and (or (executable-find "fd") |
977 | (executable-find "find")) | 974 | (executable-find "find")) |
978 | (executable-find "rg"))) | 975 | (executable-find "rg"))) |
979 | ;; Keys are bound in `acdw/sensible-grep' and `acdw/sensible-find' | 976 | ;; Keys are bound in `acdw/sensible-grep' and `acdw/sensible-find' |
980 | (:option affe-regexp-compiler | 977 | (:option affe-regexp-compiler |
981 | (defun affe-orderless-regexp-compiler (input _type) | 978 | (defun affe-orderless-regexp-compiler (input _type) |
982 | (setq input (orderless-pattern-compiler input)) | 979 | (setq input (orderless-pattern-compiler input)) |
983 | (cons input (lambda (str) (orderless--highlight input str)))))) | 980 | (cons input (lambda (str) (orderless--highlight input str)))))) |
984 | 981 | ||
985 | (setup (:straight-if ahk-mode | 982 | (setup (:straight-when ahk-mode |
986 | (acdw/system :work))) | 983 | (acdw/system :work))) |
987 | 984 | ||
988 | (setup (:straight alert) | 985 | (setup (:straight alert) |
989 | (:option alert-default-style (acdw/system | 986 | (:option alert-default-style (acdw/system |
@@ -1211,6 +1208,15 @@ specific to most general, they are these: | |||
1211 | (funcall #'vertico-exit)) | 1208 | (funcall #'vertico-exit)) |
1212 | "TAB" #'vertico-exit)))) | 1209 | "TAB" #'vertico-exit)))) |
1213 | 1210 | ||
1211 | (setup (:straight consult-dir) | ||
1212 | (:with-feature project | ||
1213 | (:autoload project--read-project-list)) | ||
1214 | (:global "C-x C-d" #'consult-dir) | ||
1215 | (with-eval-after-load 'vertico | ||
1216 | (:with-map vertico-map | ||
1217 | (:bind "C-x C-d" #'consult-dir | ||
1218 | "C-x C-j" #'consult-dir-jump-file)))) | ||
1219 | |||
1214 | (setup (:straight crux) | 1220 | (setup (:straight crux) |
1215 | (:global "C-o" #'crux-smart-open-line | 1221 | (:global "C-o" #'crux-smart-open-line |
1216 | "M-o" #'crux-smart-open-line-above | 1222 | "M-o" #'crux-smart-open-line-above |
@@ -1219,10 +1225,10 @@ specific to most general, they are these: | |||
1219 | 1225 | ||
1220 | (crux-reopen-as-root-mode +1)) | 1226 | (crux-reopen-as-root-mode +1)) |
1221 | 1227 | ||
1222 | (setup (:straight-if (define-repeat-map | 1228 | (setup (:straight-when (define-repeat-map |
1223 | :host nil | 1229 | :host nil |
1224 | :repo "https://tildegit.org/acdw/define-repeat-map.el") | 1230 | :repo "https://tildegit.org/acdw/define-repeat-map.el") |
1225 | (acdw/system :home)) | 1231 | (acdw/system :home)) |
1226 | 1232 | ||
1227 | (require 'define-repeat-map ; just for me | 1233 | (require 'define-repeat-map ; just for me |
1228 | (acdw/dir | 1234 | (acdw/dir |
@@ -1452,8 +1458,8 @@ specific to most general, they are these: | |||
1452 | (add-hook hook #'epithet-rename-buffer))) | 1458 | (add-hook hook #'epithet-rename-buffer))) |
1453 | 1459 | ||
1454 | ;; TODO: look into emms or something related for this | 1460 | ;; TODO: look into emms or something related for this |
1455 | (setup (:straight-if eradio | 1461 | (setup (:straight-when eradio |
1456 | (executable-find "mpv")) | 1462 | (executable-find "mpv")) |
1457 | (:option | 1463 | (:option |
1458 | eradio-player '("mpv" "--no-video" "--no-terminal") | 1464 | eradio-player '("mpv" "--no-video" "--no-terminal") |
1459 | eradio-channels `(("KLSU" . | 1465 | eradio-channels `(("KLSU" . |
@@ -1495,16 +1501,16 @@ specific to most general, they are these: | |||
1495 | (:hook-into emacs-lisp-mode | 1501 | (:hook-into emacs-lisp-mode |
1496 | lisp-interaction-mode)) | 1502 | lisp-interaction-mode)) |
1497 | 1503 | ||
1498 | (setup (:straight-if exec-path-from-shell | 1504 | (setup (:straight-when exec-path-from-shell |
1499 | (acdw/system :home)) | 1505 | (acdw/system :home)) |
1500 | (when (daemonp) | 1506 | (when (daemonp) |
1501 | (exec-path-from-shell-initialize))) | 1507 | (exec-path-from-shell-initialize))) |
1502 | 1508 | ||
1503 | (setup (:straight expand-region) | 1509 | (setup (:straight expand-region) |
1504 | (:global "C-=" #'er/expand-region)) | 1510 | (:global "C-=" #'er/expand-region)) |
1505 | 1511 | ||
1506 | (setup (:straight-if fennel-mode | 1512 | (setup (:straight-when fennel-mode |
1507 | (executable-find "fennel")) | 1513 | (executable-find "fennel")) |
1508 | (:autoload (fennel-repl :interactive t)) | 1514 | (:autoload (fennel-repl :interactive t)) |
1509 | (:file-match (rx ".fnl" eos))) | 1515 | (:file-match (rx ".fnl" eos))) |
1510 | 1516 | ||
@@ -1521,8 +1527,8 @@ specific to most general, they are these: | |||
1521 | (flyspell-correct-move 0 :forward :rapid)))) | 1527 | (flyspell-correct-move 0 :forward :rapid)))) |
1522 | (:unbind "C-;" "C-," "C-." "C-M-i"))) | 1528 | (:unbind "C-;" "C-," "C-." "C-M-i"))) |
1523 | 1529 | ||
1524 | (setup (:straight-if forge | 1530 | (setup (:straight-when forge |
1525 | (acdw/system :home)) | 1531 | (acdw/system :home)) |
1526 | ;; make sure to read Info manual with Forge (and Ghub) for setup | 1532 | ;; make sure to read Info manual with Forge (and Ghub) for setup |
1527 | ;; instructions. | 1533 | ;; instructions. |
1528 | (with-eval-after-load 'magit | 1534 | (with-eval-after-load 'magit |
@@ -1535,26 +1541,26 @@ specific to most general, they are these: | |||
1535 | (:option gcmh-idle-delay 'auto) | 1541 | (:option gcmh-idle-delay 'auto) |
1536 | (gcmh-mode +1)) | 1542 | (gcmh-mode +1)) |
1537 | 1543 | ||
1538 | (setup (:straight-if geiser | 1544 | (setup (:straight-when geiser |
1539 | (progn | 1545 | (progn |
1540 | (defvar acdw/schemes | 1546 | (defvar acdw/schemes |
1541 | (let (schemes) | 1547 | (let (schemes) |
1542 | (dolist (scheme '(("scheme" . geiser-chez) ; chez | 1548 | (dolist (scheme '(("scheme" . geiser-chez) ; chez |
1543 | ("petite" . geiser-chez) ; petite | 1549 | ("petite" . geiser-chez) ; petite |
1544 | ("csi" . geiser-chez) ; chicken | 1550 | ("csi" . geiser-chez) ; chicken |
1545 | ("gsi" . geiser-gambit) | 1551 | ("gsi" . geiser-gambit) |
1546 | ("gosh" . geiser-gauche) | 1552 | ("gosh" . geiser-gauche) |
1547 | ("guile" . geiser-guile) | 1553 | ("guile" . geiser-guile) |
1548 | ("kawa" . geiser-kawa) | 1554 | ("kawa" . geiser-kawa) |
1549 | ("mit-scheme" . geiser-mit) | 1555 | ("mit-scheme" . geiser-mit) |
1550 | ("racket" . geiser-racket) | 1556 | ("racket" . geiser-racket) |
1551 | ("stklos" . geiser-stklos))) | 1557 | ("stklos" . geiser-stklos))) |
1552 | (when-let (binary (executable-find (car scheme))) | 1558 | (when-let (binary (executable-find (car scheme))) |
1553 | (push binary schemes) | 1559 | (push binary schemes) |
1554 | ;; and install the proper helper package | 1560 | ;; and install the proper helper package |
1555 | (straight-use-package (cdr scheme)))) | 1561 | (straight-use-package (cdr scheme)))) |
1556 | (nreverse schemes))) | 1562 | (nreverse schemes))) |
1557 | acdw/schemes)) | 1563 | acdw/schemes)) |
1558 | (:file-match (rx ".rkt" eos) | 1564 | (:file-match (rx ".rkt" eos) |
1559 | (rx ".scm" eos))) | 1565 | (rx ".scm" eos))) |
1560 | 1566 | ||
@@ -1641,8 +1647,8 @@ specific to most general, they are these: | |||
1641 | (setup (:straight lacarte) | 1647 | (setup (:straight lacarte) |
1642 | (:global "<f10>" #'lacarte-execute-menu-command)) | 1648 | (:global "<f10>" #'lacarte-execute-menu-command)) |
1643 | 1649 | ||
1644 | (setup (:straight-if ledger-mode | 1650 | (setup (:straight-when ledger-mode |
1645 | (executable-find "ledger"))) | 1651 | (executable-find "ledger"))) |
1646 | 1652 | ||
1647 | (setup (:straight link-hint) | 1653 | (setup (:straight link-hint) |
1648 | ;; Browse web URLs with a browser with a prefix argument. | 1654 | ;; Browse web URLs with a browser with a prefix argument. |
@@ -1750,7 +1756,7 @@ browser defined in `browse-url-secondary-browser-function'." | |||
1750 | (:option modus-themes-slanted-constructs t | 1756 | (:option modus-themes-slanted-constructs t |
1751 | modus-themes-bold-constructs t | 1757 | modus-themes-bold-constructs t |
1752 | modus-themes-fringes nil | 1758 | modus-themes-fringes nil |
1753 | modus-themes-mode-line '(borderless moody) | 1759 | modus-themes-mode-line '(borderless) |
1754 | modus-themes-region '(bg-only) | 1760 | modus-themes-region '(bg-only) |
1755 | modus-themes-org-blocks 'gray-background | 1761 | modus-themes-org-blocks 'gray-background |
1756 | modus-themes-headings '((t . (background))) | 1762 | modus-themes-headings '((t . (background))) |
@@ -1908,7 +1914,7 @@ browser defined in `browse-url-secondary-browser-function'." | |||
1908 | (:option org-adapt-indentation nil | 1914 | (:option org-adapt-indentation nil |
1909 | org-agenda-files nil ; only until I set this up | 1915 | org-agenda-files nil ; only until I set this up |
1910 | org-catch-invisible-edits 'show-and-error | 1916 | org-catch-invisible-edits 'show-and-error |
1911 | org-clock-clocked-in-display 'frame-title | 1917 | org-clock-clocked-in-display 'mode-line |
1912 | org-clock-frame-title-format (cons '(t org-mode-line-string) | 1918 | org-clock-frame-title-format (cons '(t org-mode-line-string) |
1913 | (cons " --- " frame-title-format)) | 1919 | (cons " --- " frame-title-format)) |
1914 | ;;org-clock-string-limit 7 ; gives time and not title | 1920 | ;;org-clock-string-limit 7 ; gives time and not title |
@@ -1957,32 +1963,40 @@ browser defined in `browse-url-secondary-browser-function'." | |||
1957 | 1963 | ||
1958 | (:unbind "C-j" ; org-return-and-maybe-indent | 1964 | (:unbind "C-j" ; org-return-and-maybe-indent |
1959 | "M-j") | 1965 | "M-j") |
1966 | |||
1967 | (:local-set unfill-fill-function #'org-fill-paragraph) | ||
1960 | 1968 | ||
1961 | (with-eval-after-load 'org-export | 1969 | (with-eval-after-load 'org-export |
1962 | (:option (append org-export-filter-final-output-functions) | 1970 | (:option (append org-export-filter-final-output-functions) |
1963 | #'org-export-remove-zero-width-spaces)) | 1971 | #'org-export-remove-zero-width-spaces)) |
1964 | 1972 | ||
1965 | (:hook #'variable-pitch-mode | 1973 | (:hook ;; #'variable-pitch-mode |
1966 | 1974 | ||
1967 | ;; This is super ugly because I need to add a function to | 1975 | ;; (defun org-mode@before-save@fill-buffer () |
1968 | ;; `before-save-hook', but only in org-mode buffers. So I make a hook | 1976 | ;; (add-hook 'before-save-hook |
1969 | ;; to make a hook. I'm sure there's a better way to do this. | 1977 | ;; (defun before-save@fill-buffer () |
1970 | (defun org-mode@fix-blank-lines-on-save () | 1978 | ;; (fill-region (point-min) (point-max))) |
1971 | (add-hook 'before-save-hook | 1979 | ;; nil :local)) |
1972 | (defun acdw-org/fix-blank-lines-in-buffer () | 1980 | |
1973 | (acdw-org/fix-blank-lines t)) | 1981 | ;; This is super ugly because I need to add a function to |
1974 | 0 :local)) | 1982 | ;; `before-save-hook', but only in org-mode buffers. So I make a hook |
1975 | 1983 | ;; to make a hook. I'm sure there's a better way to do this. | |
1976 | (defun org-mode@wc-stupid () | 1984 | (defun org-mode@fix-blank-lines-on-save () |
1977 | (unless (and wc-mode | 1985 | (add-hook 'before-save-hook |
1978 | (> 0 (+ (or wc-orig-words 0) | 1986 | (defun acdw-org/fix-blank-lines-in-buffer () |
1979 | (or wc-words-delta 0))))) | 1987 | (acdw-org/fix-blank-lines t)) |
1980 | (setq-local | 1988 | 0 :local)) |
1981 | wc-count-words-function | 1989 | |
1982 | (lambda (start end) "Count words stupidly with a limit." | 1990 | (defun org-mode@wc-stupid () |
1983 | (acdw-org/count-words-stupidly start | 1991 | (unless (and wc-mode |
1984 | end | 1992 | (> 0 (+ (or wc-orig-words 0) |
1985 | 999))))) | 1993 | (or wc-words-delta 0))))) |
1994 | (setq-local | ||
1995 | wc-count-words-function | ||
1996 | (lambda (start end) "Count words stupidly with a limit." | ||
1997 | (acdw-org/count-words-stupidly start | ||
1998 | end | ||
1999 | 999))))) | ||
1986 | 2000 | ||
1987 | (with-eval-after-load 'org | 2001 | (with-eval-after-load 'org |
1988 | (org-clock-persistence-insinuate)) | 2002 | (org-clock-persistence-insinuate)) |
@@ -2106,10 +2120,10 @@ the default is \"/\"." | |||
2106 | lisp-interaction-mode | 2120 | lisp-interaction-mode |
2107 | scheme-mode)) | 2121 | scheme-mode)) |
2108 | 2122 | ||
2109 | (setup (:straight-if (pdf-tools | 2123 | (setup (:straight-when (pdf-tools |
2110 | :host github | 2124 | :host github |
2111 | :repo "vedang/pdf-tools") | 2125 | :repo "vedang/pdf-tools") |
2112 | (acdw/system :home)) | 2126 | (acdw/system :home)) |
2113 | (:file-match (rx ".pdf" eos)) | 2127 | (:file-match (rx ".pdf" eos)) |
2114 | (pdf-loader-install)) | 2128 | (pdf-loader-install)) |
2115 | 2129 | ||
@@ -2196,16 +2210,16 @@ the default is \"/\"." | |||
2196 | 2210 | ||
2197 | (simple-modeline-mode +1)) | 2211 | (simple-modeline-mode +1)) |
2198 | 2212 | ||
2199 | (setup (:straight-if sly | 2213 | (setup (:straight-when sly |
2200 | (progn | 2214 | (progn |
2201 | (defvar acdw/lisps | 2215 | (defvar acdw/lisps |
2202 | (let (lisps) | 2216 | (let (lisps) |
2203 | (dolist (lisp '("sbcl" ; TODO: add more lisps | 2217 | (dolist (lisp '("sbcl" ; TODO: add more lisps |
2204 | "clisp")) | 2218 | "clisp")) |
2205 | (when-let (binary (executable-find lisp)) | 2219 | (when-let (binary (executable-find lisp)) |
2206 | (push binary lisps))) | 2220 | (push binary lisps))) |
2207 | (nreverse lisps))) | 2221 | (nreverse lisps))) |
2208 | acdw/lisps)) | 2222 | acdw/lisps)) |
2209 | (:also-load sly-autoloads) | 2223 | (:also-load sly-autoloads) |
2210 | (:straight clhs) | 2224 | (:straight clhs) |
2211 | 2225 | ||
@@ -2261,7 +2275,10 @@ the default is \"/\"." | |||
2261 | (smartparens-strict-mode 1)) | 2275 | (smartparens-strict-mode 1)) |
2262 | 2276 | ||
2263 | (:bind "C-M-q" #'sp-indent-defun | 2277 | (:bind "C-M-q" #'sp-indent-defun |
2264 | "M-r" #'sp-rewrap-sexp)) | 2278 | "M-r" #'sp-rewrap-sexp) |
2279 | (:unbind "M-j" ; sp-join-sexp | ||
2280 | )) | ||
2281 | |||
2265 | (setup (:straight ssh-config-mode) | 2282 | (setup (:straight ssh-config-mode) |
2266 | (:file-match (rx "/.ssh/config" eos) | 2283 | (:file-match (rx "/.ssh/config" eos) |
2267 | (rx "/ssh" (? "d") "_config" eos)) | 2284 | (rx "/ssh" (? "d") "_config" eos)) |
@@ -2282,8 +2299,8 @@ the default is \"/\"." | |||
2282 | (auto-save-visited-mode -1) | 2299 | (auto-save-visited-mode -1) |
2283 | (super-save-mode +1)) | 2300 | (super-save-mode +1)) |
2284 | 2301 | ||
2285 | (setup (:straight-if systemd | 2302 | (setup (:straight-when systemd |
2286 | (executable-find "systemd"))) | 2303 | (executable-find "systemd"))) |
2287 | 2304 | ||
2288 | (setup (:straight (topsy | 2305 | (setup (:straight (topsy |
2289 | :host github | 2306 | :host github |
@@ -2291,7 +2308,7 @@ the default is \"/\"." | |||
2291 | (:hook-into prog-mode) | 2308 | (:hook-into prog-mode) |
2292 | (:when-loaded | 2309 | (:when-loaded |
2293 | (:option topsy-header-line-format | 2310 | (:option topsy-header-line-format |
2294 | '(:eval | 2311 | `(:eval |
2295 | (list | 2312 | (list |
2296 | (propertize " " | 2313 | (propertize " " |
2297 | 'display | 2314 | 'display |
@@ -2345,7 +2362,9 @@ If used with a numeric prefix argument N, N backticks will be inserted." | |||
2345 | 2362 | ||
2346 | (global-undo-fu-session-mode +1)) | 2363 | (global-undo-fu-session-mode +1)) |
2347 | 2364 | ||
2348 | (setup (:straight unfill)) | 2365 | (setup (:straight (unfill :host github :repo "purcell/unfill" |
2366 | :fork (:host github :repo "duckwork/unfill"))) | ||
2367 | (:global "M-q" #'unfill-toggle)) | ||
2349 | 2368 | ||
2350 | (setup (:straight (unfocused | 2369 | (setup (:straight (unfocused |
2351 | :host github | 2370 | :host github |
@@ -2395,8 +2414,8 @@ If used with a numeric prefix argument N, N backticks will be inserted." | |||
2395 | (setup (:straight visual-regexp) | 2414 | (setup (:straight visual-regexp) |
2396 | (:global "M-%" #'vr/query-replace)) | 2415 | (:global "M-%" #'vr/query-replace)) |
2397 | 2416 | ||
2398 | (setup (:straight-if vterm | 2417 | (setup (:straight-when vterm |
2399 | (acdw/system :home)) | 2418 | (acdw/system :home)) |
2400 | (:straight (eshell-vterm | 2419 | (:straight (eshell-vterm |
2401 | :host github | 2420 | :host github |
2402 | :repo "iostapyshyn/eshell-vterm")) | 2421 | :repo "iostapyshyn/eshell-vterm")) |
@@ -2452,12 +2471,15 @@ If used with a numeric prefix argument N, N backticks will be inserted." | |||
2452 | 2471 | ||
2453 | (setup (:straight xr)) | 2472 | (setup (:straight xr)) |
2454 | 2473 | ||
2455 | (setup (:straight-if ytel | 2474 | (setup (:straight-when ytdious |
2456 | (executable-find "mpv")) | 2475 | (executable-find "mpv")) |
2457 | ;; This might need to be changed depending on whether the instance goes down. | 2476 | (:also-load acdw-ytel) ; so named because I used ytel first |
2458 | (:option ytel-invidious-api-url "https://invidious.snopyta.org") | 2477 | (:option ytdious-invidious-api-url "https://invidious.snopyta.org") |
2459 | (:bind "v" #'acdw/ytel-current-video-link | 2478 | (:hook #'hl-line-mode) |
2460 | "w" #'acdw/ytel-copy-link)) | 2479 | (:global "C-c y" #'ytdious) |
2480 | (:bind "v" #'acdw/ytdious-watch | ||
2481 | "w" #'acdw/ytdious-copy-link | ||
2482 | "q" #'acdw/ytdious-quit)) | ||
2461 | 2483 | ||
2462 | (setup (:straight zzz-to-char) | 2484 | (setup (:straight zzz-to-char) |
2463 | 2485 | ||
diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index 21068bd..573a964 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el | |||
@@ -147,7 +147,7 @@ is, if point < mark." | |||
147 | (5 " C%C"))) | 147 | (5 " C%C"))) |
148 | " ")) | 148 | " ")) |
149 | (file-percentage-mode | 149 | (file-percentage-mode |
150 | (7 "%p%% ")) | 150 | ((-3 "%p") "%% ")) |
151 | ,(if (region-active-p) | 151 | ,(if (region-active-p) |
152 | (propertize (format "%s%-5d" | 152 | (propertize (format "%s%-5d" |
153 | (if (and (mark) | 153 | (if (and (mark) |
diff --git a/lisp/acdw-setup.el b/lisp/acdw-setup.el index eb4d12b..33ab835 100644 --- a/lisp/acdw-setup.el +++ b/lisp/acdw-setup.el | |||
@@ -72,7 +72,7 @@ first RECIPE's package." | |||
72 | (car recipe) | 72 | (car recipe) |
73 | recipe)))) | 73 | recipe)))) |
74 | 74 | ||
75 | (setup-define :straight-if | 75 | (setup-define :straight-when |
76 | (lambda (recipe condition) | 76 | (lambda (recipe condition) |
77 | `(if ,condition | 77 | `(if ,condition |
78 | (straight-use-package ',recipe) | 78 | (straight-use-package ',recipe) |
@@ -83,6 +83,7 @@ If CONDITION is false, stop evaluating the body. This macro can | |||
83 | be used as HEAD, and will replace itself with the RECIPE's | 83 | be used as HEAD, and will replace itself with the RECIPE's |
84 | package. This macro is not repeatable." | 84 | package. This macro is not repeatable." |
85 | :repeatable nil | 85 | :repeatable nil |
86 | :indent 1 | ||
86 | :shorthand (lambda (sexp) | 87 | :shorthand (lambda (sexp) |
87 | (let ((recipe (cadr sexp))) | 88 | (let ((recipe (cadr sexp))) |
88 | (if (consp recipe) (car recipe) recipe)))) | 89 | (if (consp recipe) (car recipe) recipe)))) |
diff --git a/lisp/acdw-ytel.el b/lisp/acdw-ytel.el index 01e6187..276323d 100644 --- a/lisp/acdw-ytel.el +++ b/lisp/acdw-ytel.el | |||
@@ -7,12 +7,12 @@ | |||
7 | 7 | ||
8 | ;;; Code: | 8 | ;;; Code: |
9 | 9 | ||
10 | (require 'ytel) | 10 | (require 'ytel nil t) |
11 | 11 | ||
12 | (defun acdw/ytel-current-video-link () | 12 | (defun acdw/ytel-current-video-link () |
13 | "Get the link of the video at point." | 13 | "Get the link of the video at point." |
14 | (let* ((video (ytel-get-current-video)) | 14 | (let* ((video (ytel-get-current-video)) |
15 | (id (ytel-video-id video))) | 15 | (id (ytel-video-id video))) |
16 | (concat "https://www.youtube.com/watch?v=" id))) | 16 | (concat "https://www.youtube.com/watch?v=" id))) |
17 | 17 | ||
18 | (defun acdw/ytel-watch () ; This could possibly use `browse-url'. | 18 | (defun acdw/ytel-watch () ; This could possibly use `browse-url'. |
@@ -31,5 +31,45 @@ | |||
31 | (kill-new link) | 31 | (kill-new link) |
32 | (message "Copied %s to kill-ring" link))) | 32 | (message "Copied %s to kill-ring" link))) |
33 | 33 | ||
34 | |||
35 | ;;; YTDIOUS: https://github.com/spiderbit/ytdious | ||
36 | ;; a fork of ytel that uses table-view or w/e. looks nicer | ||
37 | |||
38 | (require 'ytdious nil t) | ||
39 | |||
40 | (defun acdw/ytdious-current-video-link () | ||
41 | "Get the link of the video at point." | ||
42 | (let* ((video (ytdious-get-current-video)) | ||
43 | (id (ytdious-video-id-fun video))) | ||
44 | (concat "https://www.youtube.com/watch?v=" id))) | ||
45 | |||
46 | (defun acdw/ytdious-watch () ; This could possibly use `browse-url'. | ||
47 | "Stream video at point in mpv." | ||
48 | (interactive) | ||
49 | (let ((link (acdw/ytdious-current-video-link))) | ||
50 | (start-process "ytdious mpv" nil | ||
51 | "mpv" | ||
52 | link | ||
53 | "--ytdl-format=bestvideo[height<=?720]+bestaudio/best") | ||
54 | (message "Streaming %s..." link))) | ||
55 | |||
56 | (defun acdw/ytdious-copy-link () | ||
57 | "Copy link of the video at point." | ||
58 | (interactive) | ||
59 | (let ((link (acdw/ytdious-current-video-link))) | ||
60 | (kill-new link) | ||
61 | (message "Copied %s to kill-ring" link))) | ||
62 | |||
63 | (defun acdw/ytdious-quit () | ||
64 | "Quit ytdious." | ||
65 | ;; This corrects an error with `ytdious-quit' where it doesn't have the right | ||
66 | ;; buffer setup. | ||
67 | (interactive) | ||
68 | (quit-window)) | ||
69 | |||
70 | ;;; Ignore `ytdious-show-image-asyncron' because it's buggy. | ||
71 | |||
72 | (defalias 'ytdious-show-image-asyncron #'ignore) | ||
73 | |||
34 | (provide 'acdw-ytel) | 74 | (provide 'acdw-ytel) |
35 | ;;; acdw-ytel.el ends here | 75 | ;;; acdw-ytel.el ends here |
diff --git a/lisp/acdw.el b/lisp/acdw.el index 792b9ef..969b6c8 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -352,7 +352,7 @@ In short, DO NOT USE THIS FUNCTION!!!" | |||
352 | (cond | 352 | (cond |
353 | ;; Straight forms require some weirdness | 353 | ;; Straight forms require some weirdness |
354 | ((and s1-straight s2-straight) | 354 | ((and s1-straight s2-straight) |
355 | (let* ((r (rx ":straight" (? "-if") (* space) (? "("))) | 355 | (let* ((r (rx ":straight" (? "-when") (* space) (? "("))) |
356 | (s1 (replace-regexp-in-string r "" s1)) | 356 | (s1 (replace-regexp-in-string r "" s1)) |
357 | (s2 (replace-regexp-in-string r "" s2))) | 357 | (s2 (replace-regexp-in-string r "" s2))) |
358 | (string< s1 s2))) | 358 | (string< s1 s2))) |
@@ -793,6 +793,32 @@ This function is internal. Use `acdw/make-password-fetcher' instead." | |||
793 | (insert "💩") | 793 | (insert "💩") |
794 | (setq n (1- n))))) | 794 | (setq n (1- n))))) |
795 | 795 | ||
796 | (defun spongebob-case-region (beg end) | ||
797 | "Make region, defined by BEG and END, lOoK lIkE tHiS." | ||
798 | (interactive "*r") | ||
799 | (save-excursion | ||
800 | (let (case) | ||
801 | (goto-char beg) | ||
802 | (while (< (point) end) | ||
803 | (if (looking-at "[[:alpha:]]") | ||
804 | (if (setq case (not case)) | ||
805 | (upcase-region (point) (progn (forward-char 1) (point))) | ||
806 | (downcase-region (point) (progn (forward-char 1) (point)))) | ||
807 | (forward-char 1)))))) | ||
808 | |||
809 | (defun spongebob-case-word (n) | ||
810 | "Spongebob-case N words forward, beginning at point, moving over." | ||
811 | (interactive "*p") | ||
812 | (spongebob-case-region (point) (progn (forward-word n) (point)))) | ||
813 | |||
814 | (defun spongebob-case-dwim (arg) | ||
815 | "Spongebob-case words in the region if active, else word at point. | ||
816 | If ARG exists, it's passed to `spongebob-case-word'." | ||
817 | (interactive "*p") | ||
818 | (if (use-region-p) | ||
819 | (spongebob-case-region (region-beginning) (region-end)) | ||
820 | (spongebob-case-word arg))) | ||
821 | |||
796 | 822 | ||
797 | ;;; Fat finger solutions | 823 | ;;; Fat finger solutions |
798 | (defun acdw/fat-finger-exit (&optional prefix) | 824 | (defun acdw/fat-finger-exit (&optional prefix) |