about summary refs log tree commit diff stats
path: root/lisp/acdw.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/acdw.el')
-rw-r--r--lisp/acdw.el23
1 files changed, 22 insertions, 1 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index 7ef745d..6707e76 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -138,6 +138,10 @@ active, or else the entire buffer."
138 (= (line-beginning-position) (line-end-position))) 138 (= (line-beginning-position) (line-end-position)))
139 (insert "\n"))))) 139 (insert "\n")))))
140 140
141(defcustom +open-paragraph-ignore-modes '(special-mode lui-mode comint-mode)
142 "Modes in which `+open-paragraph' makes no sense."
143 :type '(repeat function))
144
141(defun +open-paragraph (&optional arg) 145(defun +open-paragraph (&optional arg)
142 "Open a paragraph after paragraph at point. 146 "Open a paragraph after paragraph at point.
143A paragraph is defined as continguous non-empty lines of text 147A paragraph is defined as continguous non-empty lines of text
@@ -148,7 +152,7 @@ Called with prefix ARG, open a paragraph before point."
148 ;; TODO: Take an integer as ARG, allowing for skipping paragraphs up and down. 152 ;; TODO: Take an integer as ARG, allowing for skipping paragraphs up and down.
149 (interactive "*P") 153 (interactive "*P")
150 ;; TODO: add `+open-paragraph-ignore-modes' 154 ;; TODO: add `+open-paragraph-ignore-modes'
151 (unless (derived-mode-p 'special-mode 'lui-mode 'comint-mode) 155 (unless (apply #'derived-mode-p +open-paragraph-ignore-modes)
152 ;; Go to next blank line. This /isn't/ `end-of-paragraph-text' because 156 ;; Go to next blank line. This /isn't/ `end-of-paragraph-text' because
153 ;; that's weird with org, and I'm guessing other modes too. 157 ;; that's weird with org, and I'm guessing other modes too.
154 (unless (looking-at "^$") (forward-line (if arg -1 +1))) 158 (unless (looking-at "^$") (forward-line (if arg -1 +1)))
@@ -426,5 +430,22 @@ This calls `indent-rigidly' and passes ARG to it."
426 (goto-char (line-end-position))) 430 (goto-char (line-end-position)))
427 (call-interactively #'indent-rigidly)) 431 (call-interactively #'indent-rigidly))
428 432
433(defun +sort-lines (reverse beg end)
434 "Sort lines in region, ignoring leading whitespace.
435REVERSE non-nil means descending order; interactively, REVERSE is
436the prefix argument, and BEG and END are the region. The
437variable `sort-fold-case' determines whether case affects the
438sort order."
439 (interactive "P\nr")
440 (save-excursion
441 (save-restriction
442 (narrow-to-region beg end)
443 (goto-char (point-min))
444 (let ((inhibit-field-text-motion t))
445 (sort-subr reverse
446 #'forward-line
447 #'end-of-line
448 #'beginning-of-line-text)))))
449
429(provide 'acdw) 450(provide 'acdw)
430;;; acdw.el ends here 451;;; acdw.el ends here