diff options
-rw-r--r-- | lisp/acdw.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index 10a51c1..171a109 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -431,5 +431,22 @@ This calls `indent-rigidly' and passes ARG to it." | |||
431 | (goto-char (line-end-position))) | 431 | (goto-char (line-end-position))) |
432 | (call-interactively #'indent-rigidly)) | 432 | (call-interactively #'indent-rigidly)) |
433 | 433 | ||
434 | (defun +sort-lines (reverse beg end) | ||
435 | "Sort lines in region, ignoring leading whitespace. | ||
436 | REVERSE non-nil means descending order; interactively, REVERSE is | ||
437 | the prefix argument, and BEG and END are the region. The | ||
438 | variable `sort-fold-case' determines whether case affects the | ||
439 | sort order." | ||
440 | (interactive "P\nr") | ||
441 | (save-excursion | ||
442 | (save-restriction | ||
443 | (narrow-to-region beg end) | ||
444 | (goto-char (point-min)) | ||
445 | (let ((inhibit-field-text-motion t)) | ||
446 | (sort-subr reverse | ||
447 | #'forward-line | ||
448 | #'end-of-line | ||
449 | #'beginning-of-line-text))))) | ||
450 | |||
434 | (provide 'acdw) | 451 | (provide 'acdw) |
435 | ;;; acdw.el ends here | 452 | ;;; acdw.el ends here |