Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Version of #'endless/fill-or-unfill and key bindings that work in org-mode
(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
You can’t perform that action at this time.