Re-install (new and improved!) filldent.el
This commit is contained in:
parent
0411f2a6e5
commit
cdb6c1cf89
5
init.el
5
init.el
|
@ -656,6 +656,11 @@ See also `crux-reopen-as-root-mode'."
|
|||
(setup (:straight expand-region)
|
||||
(:+key "C-=" #'er/expand-region))
|
||||
|
||||
(setup (:straight (filldent
|
||||
:host github
|
||||
:repo "duckwork/filldent.el"))
|
||||
(:+key "M-q" #'filldent-dwim))
|
||||
|
||||
(setup (:straight (frowny
|
||||
:host github
|
||||
:repo "duckwork/frowny.el"))
|
||||
|
|
|
@ -201,25 +201,6 @@ kill without asking."
|
|||
(save-buffers-kill-emacs))
|
||||
(server-save-buffers-kill-terminal nil)))
|
||||
|
||||
(defun +filldent-dwim (&optional arg)
|
||||
"Fill and indent region if active, or current defun/paragraph.
|
||||
Optional ARG causes the paragraph to \"unfill.\""
|
||||
;; I wrote a whole package for this --- filldent.el --- but under further
|
||||
;; inspection it seems as though Emacs is smart enough in most cases.
|
||||
;; Possible TODO: make calling this twice in a row restore the buffer how it
|
||||
;; was.
|
||||
(interactive "*P")
|
||||
(let ((fill-column (if arg most-positive-fixnum fill-column)))
|
||||
(if (region-active-p)
|
||||
(progn
|
||||
(fill-region (region-beginning) (region-end))
|
||||
(indent-region (region-beginning) (region-end)))
|
||||
(progn
|
||||
(fill-paragraph)
|
||||
(save-excursion
|
||||
(mark-defun)
|
||||
(indent-region (region-beginning) (region-end)))))))
|
||||
|
||||
;;; Bindings
|
||||
|
||||
;; 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.\""
|
|||
("M-SPC" . +cycle-spacing)
|
||||
("M-/" . hippie-expand)
|
||||
("M-=" . count-words)
|
||||
("M-q" . +filldent-dwim)
|
||||
("C-x C-b" . ibuffer)
|
||||
("C-s" . isearch-forward-regexp)
|
||||
("C-r" . isearch-backward-regexp)
|
||||
|
|
Loading…
Reference in New Issue