From d134922c7c5ff3ff9f86cb0c04100bdd5436c754 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 6 Oct 2021 11:16:18 -0500 Subject: Add open-paragraph --- init.el | 2 +- lisp/acdw.el | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index a1536c5..2361107 100644 --- a/init.el +++ b/init.el @@ -1222,7 +1222,7 @@ specific to most general, they are these: (setup (:straight crux) (:global "C-o" #'crux-smart-open-line - "M-o" #'crux-smart-open-line-above + "M-o" #'open-paragraph "C-M-\\" #'crux-cleanup-buffer-or-region "C-x 4 t" #'crux-transpose-windows) diff --git a/lisp/acdw.el b/lisp/acdw.el index 969b6c8..cc73071 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -862,6 +862,23 @@ When called with PREFIX, just kill Emacs without confirmation." (let ((b (get-buffer (if (consp b) (car b) b)))) (member (buffer-local-value 'major-mode b) modes))))) (pop-to-buffer (read-buffer "Buffer: " nil t pred)))) + +;;; BLAH + +(defun open-paragraph () + "Open a paragraph after point. +A paragraph is defined as continguous non-empty lines of text +surrounded by empty lines, so opening a paragraph means to make +three blank lines, then place the point on the second one." + (interactive) + ;; 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. + (while (not (looking-at "^$")) + (forward-line 1)) + (newline) + (delete-blank-lines) + (newline 2) + (previous-line)) (provide 'acdw) ;;; acdw.el ends here -- cgit 1.4.1-21-gabe81