summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el5
-rw-r--r--lisp/+emacs.el20
2 files changed, 5 insertions, 20 deletions
diff --git a/init.el b/init.el index 937e9a1..d4a6a0f 100644 --- a/init.el +++ b/init.el
@@ -656,6 +656,11 @@ See also `crux-reopen-as-root-mode'."
656(setup (:straight expand-region) 656(setup (:straight expand-region)
657 (:+key "C-=" #'er/expand-region)) 657 (:+key "C-=" #'er/expand-region))
658 658
659(setup (:straight (filldent
660 :host github
661 :repo "duckwork/filldent.el"))
662 (:+key "M-q" #'filldent-dwim))
663
659(setup (:straight (frowny 664(setup (:straight (frowny
660 :host github 665 :host github
661 :repo "duckwork/frowny.el")) 666 :repo "duckwork/frowny.el"))
diff --git a/lisp/+emacs.el b/lisp/+emacs.el index fa94a10..7ad6768 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el
@@ -201,25 +201,6 @@ 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.
206Optional 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
223;;; Bindings 204;;; Bindings
224 205
225;; I need to place these bindings under `+key-mode-map' so that they aren't 206;; I need to place these bindings under `+key-mode-map' so that they aren't
@@ -230,7 +211,6 @@ Optional ARG causes the paragraph to \"unfill.\""
230 ("M-SPC" . +cycle-spacing) 211 ("M-SPC" . +cycle-spacing)
231 ("M-/" . hippie-expand) 212 ("M-/" . hippie-expand)
232 ("M-=" . count-words) 213 ("M-=" . count-words)
233 ("M-q" . +filldent-dwim)
234 ("C-x C-b" . ibuffer) 214 ("C-x C-b" . ibuffer)
235 ("C-s" . isearch-forward-regexp) 215 ("C-s" . isearch-forward-regexp)
236 ("C-r" . isearch-backward-regexp) 216 ("C-r" . isearch-backward-regexp)