diff options
author | Case Duckworth | 2021-12-28 22:15:43 -0600 |
---|---|---|
committer | Case Duckworth | 2021-12-28 22:15:43 -0600 |
commit | cdb6c1cf893ce75f4aef39d18dafcb78501c017c (patch) | |
tree | 2f61ac4e0bf92fab88d18996493136a9deeec4bb | |
parent | Advise elfeed-search-update--force to save the db after (diff) | |
download | emacs-cdb6c1cf893ce75f4aef39d18dafcb78501c017c.tar.gz emacs-cdb6c1cf893ce75f4aef39d18dafcb78501c017c.zip |
Re-install (new and improved!) filldent.el
-rw-r--r-- | init.el | 5 | ||||
-rw-r--r-- | lisp/+emacs.el | 20 |
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. | ||
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 | |||
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) |