diff --git a/modules/siren-text-manipulation.el b/modules/siren-text-manipulation.el index 527ec4e..ddc3af5 100644 --- a/modules/siren-text-manipulation.el +++ b/modules/siren-text-manipulation.el @@ -57,8 +57,22 @@ (lambda (x) (cons (random) (concat x "\n"))) lines) (lambda (a b) (< (car a) (car b)))))))) +;; from: https://www.emacswiki.org/emacs/SortWords +(defun sort-words (reverse beg end) + "Sort words in region alphabetically, in REVERSE if negative. +Prefixed with negative \\[universal-argument], sorts in reverse. + +The variable `sort-fold-case' determines whether alphabetic case +affects the sort order. + +See `sort-regexp-fields'." + (interactive "*P\nr") + (sort-regexp-fields reverse "\\w+" "\\&" beg end)) + (global-set-key (kbd "C-c /") 'comment-or-uncomment-region-or-line) (global-set-key (kbd "C-c C-/") 'comment-or-uncomment-region-or-line) +(defalias 'sw 'sort-words) + (provide 'siren-text-manipulation) ;;; siren-text-manipulation.el ends here