Emacs: Add argument for case-folding in sort-lines-unique

master
Pierre Neidhardt 2015-09-12 12:02:53 +02:00
parent d59842c55c
commit ee40c77a32
1 changed files with 6 additions and 4 deletions

View File

@ -460,16 +460,18 @@ Hook function for skeletons."
(pos (goto-char pos)) (pos (goto-char pos))
(t (goto-char (car skeleton-markers))))))) (t (goto-char (car skeleton-markers)))))))
(defun sort-lines-unique () (defun sort-lines-unique (arg)
"Remove trailing white space, then duplicate lines, then sort the result." "Remove trailing white space, then duplicate lines, then sort the result.
(interactive) Do not folder case with universal argument or non-nil ARG."
(interactive "P")
(unless mark-active (unless mark-active
(mark-whole-buffer)) (mark-whole-buffer))
(when (> (point) (mark)) (when (> (point) (mark))
(exchange-point-and-mark)) (exchange-point-and-mark))
(delete-trailing-whitespace (point) (mark)) (delete-trailing-whitespace (point) (mark))
(delete-duplicate-lines (point) (mark)) (delete-duplicate-lines (point) (mark))
(sort-lines nil (point) (mark))) (let ((sort-fold-case (if arg nil t)))
(sort-lines nil (point) (mark))))
(defun swap-windows () (defun swap-windows ()
"If you have 2 windows, it swaps them." "If you have 2 windows, it swaps them."