diff options
author | Case Duckworth | 2022-05-09 20:37:17 -0500 |
---|---|---|
committer | Case Duckworth | 2022-05-09 20:37:17 -0500 |
commit | 4c4dd0e7824d4bf634923de19e14bbb9274c9408 (patch) | |
tree | 0928862fe65aa99249acf42c2168160a18088a21 /lisp/acdw.el | |
parent | meh (diff) | |
parent | Further modeline changes (diff) | |
download | emacs-4c4dd0e7824d4bf634923de19e14bbb9274c9408.tar.gz emacs-4c4dd0e7824d4bf634923de19e14bbb9274c9408.zip |
Merged
Diffstat (limited to 'lisp/acdw.el')
-rw-r--r-- | lisp/acdw.el | 23 |
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. |
143 | A paragraph is defined as continguous non-empty lines of text | 147 | A 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. | ||
435 | REVERSE non-nil means descending order; interactively, REVERSE is | ||
436 | the prefix argument, and BEG and END are the region. The | ||
437 | variable `sort-fold-case' determines whether case affects the | ||
438 | sort 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 |