Hi Giovanni,

You need to put the following lines into your .emacs to sort WORDS and LINES.

--8<---------------cut here---------------start------------->8---

;;;Sort words
 (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))

--8<---------------cut here---------------start------------->8---

Then to sort words like

apple, mango, oranges, cat, elephant

You need to do

M-x sort-words

To sort lines, similarly do

M-x sort-lines


-----------------------------
Sanjib Sikder
Ph.D. Fellow
Chemical Engineering
IIT Bombay






On Mon, Oct 22, 2012 at 5:10 PM, Giovanni Ridolfi <giovanni.ridolfi@yahoo.it> wrote:
Da: Sanjib Sikder <sanjibju2002@gmail.com>

Inviato: Luned́ 22 Ottobre 2012 13:27


> I know it is possible to sort words and sort lines alphabetically in emacs org-mode

Would you please be so kind to explain to me how?

I have only:
org-sort-entries          M-x ... RET     Sort entries on a certain level of an outline tree.
org-sort-list              M-x ... RET       Sort list items.
org-table-sort-lines                           <Sort lines in region> in a table.


Is it possible to sort words like:

banana fruit chees  apple

or lines like


banana

fruit
chees

apple



> but is it possible to sort phrases ?

> Face the music, Fifteen minutes of fame, A beautiful mind.
> I want to sort it alphabetically like,
>  A beautiful mind, Face the music, Fifteen minutes of fame.

In Emacs everything is possible.

- substitute "," with \n
- sort region
- substitute \n with ","

Cheers,

Giovanni