Add +sort-lines
This commit is contained in:
parent
246990fd15
commit
1df15735b2
17
lisp/acdw.el
17
lisp/acdw.el
|
@ -431,5 +431,22 @@ This calls `indent-rigidly' and passes ARG to it."
|
|||
(goto-char (line-end-position)))
|
||||
(call-interactively #'indent-rigidly))
|
||||
|
||||
(defun +sort-lines (reverse beg end)
|
||||
"Sort lines in region, ignoring leading whitespace.
|
||||
REVERSE non-nil means descending order; interactively, REVERSE is
|
||||
the prefix argument, and BEG and END are the region. The
|
||||
variable `sort-fold-case' determines whether case affects the
|
||||
sort order."
|
||||
(interactive "P\nr")
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(narrow-to-region beg end)
|
||||
(goto-char (point-min))
|
||||
(let ((inhibit-field-text-motion t))
|
||||
(sort-subr reverse
|
||||
#'forward-line
|
||||
#'end-of-line
|
||||
#'beginning-of-line-text)))))
|
||||
|
||||
(provide 'acdw)
|
||||
;;; acdw.el ends here
|
||||
|
|
Loading…
Reference in New Issue