Make modes in which to ignore open-paragraph a customization option

This commit is contained in:
Case Duckworth 2022-05-06 10:21:32 -05:00
parent e3356d3c39
commit 246990fd15
1 changed files with 5 additions and 1 deletions

View File

@ -139,6 +139,10 @@ active, or else the entire buffer."
(= (line-beginning-position) (line-end-position)))
(insert "\n")))))
(defcustom +open-paragraph-ignore-modes '(special-mode lui-mode comint-mode)
"Modes in which `+open-paragraph' makes no sense."
:type '(repeat function))
(defun +open-paragraph (&optional arg)
"Open a paragraph after paragraph at point.
A paragraph is defined as continguous non-empty lines of text
@ -149,7 +153,7 @@ Called with prefix ARG, open a paragraph before point."
;; TODO: Take an integer as ARG, allowing for skipping paragraphs up and down.
(interactive "*P")
;; TODO: add `+open-paragraph-ignore-modes'
(unless (derived-mode-p 'special-mode 'lui-mode 'comint-mode)
(unless (apply #'derived-mode-p +open-paragraph-ignore-modes)
;; Go to next blank line. This /isn't/ `end-of-paragraph-text' because
;; that's weird with org, and I'm guessing other modes too.
(unless (looking-at "^$") (forward-line (if arg -1 +1)))