Created
August 28, 2018 16:09
-
-
Save heikkil/a3edf506046c84f6f508edbaf005810a to your computer and use it in GitHub Desktop.
Version of #'endless/fill-or-unfill and key bindings that work in org-mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun endless/fill-or-unfill () | |
"Like `fill-paragraph', but unfill if used twice." | |
(interactive) | |
(let ((fill-column | |
(if (eq last-command #'endless/fill-or-unfill) | |
(progn (setq this-command nil) | |
(point-max)) | |
fill-column))) | |
(if (eq major-mode 'org-mode) | |
(call-interactively #' org-fill-paragraph) | |
(call-interactively #'fill-paragraph)))) | |
(define-key org-mode-map (kbd "M-q") #'endless/fill-or-unfill) | |
(global-set-key [remap fill-paragraph] #'endless/fill-or-unfill) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment