Emacs function to case-insensitive sort-lines?

elisp, emacs

Solution

Pretty straightforward:

(defun sort-lines-nocase ()
  (interactive)
  (let ((sort-fold-case t))
    (call-interactively 'sort-lines)))

Problem

I know that you can do the following to sort-lines in emacs without case sensitivity: ``` M-x set-variable [RETURN] sort-fold-case [RETURN] t [RETURN] M-x sort-lines M-x set-variable [RETURN] sort-fold-case [RETURN] nil [RETURN] ``` But this is annoying to do every time. How can I turn this into a function so that I don't have to do the same thing over and over?

Original source