summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2022-05-06 10:21:51 -0500
committerCase Duckworth2022-05-06 10:21:51 -0500
commit1df15735b2fe65cf59ef9d3d84ad3175e35cb682 (patch)
tree5949267d6ecf1fe5e023fa44e20d112c99b8185a /lisp
parentMake modes in which to ignore open-paragraph a customization option (diff)
downloademacs-1df15735b2fe65cf59ef9d3d84ad3175e35cb682.tar.gz
emacs-1df15735b2fe65cf59ef9d3d84ad3175e35cb682.zip
Add +sort-lines
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw.el17
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.
436REVERSE non-nil means descending order; interactively, REVERSE is
437the prefix argument, and BEG and END are the region. The
438variable `sort-fold-case' determines whether case affects the
439sort 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