diff options
author | Case Duckworth | 2021-12-25 01:25:25 -0600 |
---|---|---|
committer | Case Duckworth | 2021-12-25 01:25:25 -0600 |
commit | 30cd6555bfa43e792eaac5ae32e39d7cafa5a3e2 (patch) | |
tree | 2de90a4b6924eb10e8ee20fd494b89a7cbfa5d8d | |
parent | Changes and shit (diff) | |
download | emacs-30cd6555bfa43e792eaac5ae32e39d7cafa5a3e2.tar.gz emacs-30cd6555bfa43e792eaac5ae32e39d7cafa5a3e2.zip |
Bunch of changes; notably +filldent-dwim
I might add this into filldent.el as `filldent-stupidly', later.
-rw-r--r-- | init.el | 12 | ||||
-rw-r--r-- | lisp/+emacs.el | 49 |
2 files changed, 38 insertions, 23 deletions
diff --git a/init.el b/init.el index e8dd1c9..86dca9a 100644 --- a/init.el +++ b/init.el | |||
@@ -108,6 +108,7 @@ | |||
108 | "imgur.com" | 108 | "imgur.com" |
109 | "pixelfed" "instagram.com" "bibliogram.art" | 109 | "pixelfed" "instagram.com" "bibliogram.art" |
110 | "reddit.com" "teddit.net" | 110 | "reddit.com" "teddit.net" |
111 | "tildes.net" | ||
111 | "taskiq" | 112 | "taskiq" |
112 | "twitter.com" "nitter.net" | 113 | "twitter.com" "nitter.net" |
113 | )) | 114 | )) |
@@ -562,11 +563,6 @@ See also `crux-reopen-as-root-mode'." | |||
562 | (setup (:straight expand-region) | 563 | (setup (:straight expand-region) |
563 | (:+key "C-=" 'er/expand-region)) | 564 | (:+key "C-=" 'er/expand-region)) |
564 | 565 | ||
565 | (setup (:straight (filldent | ||
566 | :host github | ||
567 | :repo "duckwork/filldent.el")) | ||
568 | (:+key "M-q" 'filldent-dwim)) | ||
569 | |||
570 | (setup (:straight (frowny | 566 | (setup (:straight (frowny |
571 | :host github | 567 | :host github |
572 | :repo "duckwork/frowny.el")) | 568 | :repo "duckwork/frowny.el")) |
@@ -747,7 +743,6 @@ See also `crux-reopen-as-root-mode'." | |||
747 | "C-c C-p" '+org-previous-heading-widen) | 743 | "C-c C-p" '+org-previous-heading-widen) |
748 | (:+leader "c" 'org-capture "C-c" 'org-capture | 744 | (:+leader "c" 'org-capture "C-c" 'org-capture |
749 | "a" 'org-agenda "C-a" 'org-agenda) | 745 | "a" 'org-agenda "C-a" 'org-agenda) |
750 | (:local-set unfill-fill-function 'org-fill-paragraph) | ||
751 | (:local-hook before-save-hook '+org-before-save@prettify-buffer) | 746 | (:local-hook before-save-hook '+org-before-save@prettify-buffer) |
752 | (advice-add 'org-delete-backward-char :override '+org-delete-backward-char) | 747 | (advice-add 'org-delete-backward-char :override '+org-delete-backward-char) |
753 | (with-eval-after-load 'org | 748 | (with-eval-after-load 'org |
@@ -868,11 +863,6 @@ See also `crux-reopen-as-root-mode'." | |||
868 | undo-fu-session-compression (eq system-type 'gnu/linux)) | 863 | undo-fu-session-compression (eq system-type 'gnu/linux)) |
869 | (global-undo-fu-session-mode +1)) | 864 | (global-undo-fu-session-mode +1)) |
870 | 865 | ||
871 | (setup (:straight (unfill :host github :repo "purcell/unfill" | ||
872 | :fork (:host github :repo "duckwork/unfill"))) | ||
873 | (:bind-into text-mode | ||
874 | "M-q" #'unfill-toggle)) | ||
875 | |||
876 | (setup (:straight (vertico | 866 | (setup (:straight (vertico |
877 | :host github | 867 | :host github |
878 | :repo "minad/vertico" | 868 | :repo "minad/vertico" |
diff --git a/lisp/+emacs.el b/lisp/+emacs.el index 3fe243c..ecf1ec5 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el | |||
@@ -201,20 +201,45 @@ kill without asking." | |||
201 | (save-buffers-kill-emacs)) | 201 | (save-buffers-kill-emacs)) |
202 | (server-save-buffers-kill-terminal nil))) | 202 | (server-save-buffers-kill-terminal nil))) |
203 | 203 | ||
204 | (defun +filldent-dwim (&optional arg) | ||
205 | "Fill and indent region if active, or current defun/paragraph. | ||
206 | Optional ARG causes the paragraph to \"unfill.\"" | ||
207 | ;; I wrote a whole package for this --- filldent.el --- but under further | ||
208 | ;; inspection it seems as though Emacs is smart enough in most cases. | ||
209 | ;; Possible TODO: make calling this twice in a row restore the buffer how it | ||
210 | ;; was. | ||
211 | (interactive "*P") | ||
212 | (let ((fill-column (if arg most-positive-fixnum fill-column))) | ||
213 | (if (region-active-p) | ||
214 | (progn | ||
215 | (fill-region (region-beginning) (region-end)) | ||
216 | (indent-region (region-beginning) (region-end))) | ||
217 | (progn | ||
218 | (fill-paragraph) | ||
219 | (save-excursion | ||
220 | (mark-defun) | ||
221 | (indent-region (region-beginning) (region-end))))))) | ||
222 | |||
204 | ;;; Bindings | 223 | ;;; Bindings |
205 | 224 | ||
206 | (global-set-key (kbd "C-x C-c") '+save-buffers-quit) | 225 | ;; I need to place these bindings under `+key-mode-map' so that they aren't |
207 | (global-set-key (kbd "M-SPC") '+cycle-spacing) | 226 | ;; shadowed by other maps. There might be a better way to do this. |
208 | (global-set-key (kbd "M-/") 'hippie-expand) | 227 | (require +key) |
209 | (global-set-key (kbd "M-=") 'count-words) | 228 | |
210 | (global-set-key (kbd "C-x C-b") 'ibuffer) | 229 | (dolist (binding '(("C-x C-c" . +save-buffers-quit) |
211 | (global-set-key (kbd "C-s") 'isearch-forward-regexp) | 230 | ("M-SPC" . +cycle-spacing) |
212 | (global-set-key (kbd "C-r") 'isearch-backward-regexp) | 231 | ("M-/" . hippie-expand) |
213 | (global-set-key (kbd "C-M-s") 'isearch-forward) | 232 | ("M-=" . count-words) |
214 | (global-set-key (kbd "C-M-r") 'isearch-backward) | 233 | ("M-q" . +filldent-dwim) |
215 | (global-set-key (kbd "M-u") 'upcase-dwim) | 234 | ("C-x C-b" . ibuffer) |
216 | (global-set-key (kbd "M-l") 'downcase-dwim) | 235 | ("C-s" . isearch-forward-regexp) |
217 | (global-set-key (kbd "M-c") 'capitalize-dwim) | 236 | ("C-r" . isearch-backward-regexp) |
237 | ("C-M-s" . isearch-forward) | ||
238 | ("C-M-r" . isearch-backward) | ||
239 | ("M-u" . upcase-dwim) | ||
240 | ("M-l" . downcase-dwim) | ||
241 | ("M-c" . capitalize-dwim))) | ||
242 | (define-key +key-mode-map (kbd (car binding)) (cdr binding))) | ||
218 | 243 | ||
219 | ;;; Required libraries | 244 | ;;; Required libraries |
220 | 245 | ||