Borrow fill-or-unfill-paragraph from sachachua

This commit is contained in:
Gergely Polonkai 2016-11-28 05:23:11 +01:00
parent 09d986d989
commit f5d29d0e1c
2 changed files with 11 additions and 0 deletions

View File

@ -1048,6 +1048,7 @@
("M-t W" . transpose-windows)
("C-a" . gpolonkai/move-to-beginning-of-line)
("C-e" . gpolonkai/move-to-end-of-line)
("M-q" . sachachua/fill-or-unfill-paragraph)
:map ctl-x-map
("C-y" . duplicate-line)
("_" . maximize-window)

View File

@ -5,3 +5,13 @@
(when (looking-back "[.!?…]")
(call-interactively 'self-insert-command arg))
(call-interactively 'self-insert-command arg))
;; From http://pages.sachachua.com/.emacs.d/Sacha.html
(defun sachachua/fill-or-unfill-paragraph (&optional unfill region)
"Fill paragraph (or REGION).
With the prefix argument UNFILL, unfill it instead."
(interactive (progn
(barf-if-buffer-read-only)
(list (if current-prefix-arg 'unfill) t)))
(let ((fill-column (if unfill (point-max) fill-column)))
(fill-paragraph nil region)))