emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sanjib Sikder <sanjibju2002@gmail.com>
To: Giovanni Ridolfi <giovanni.ridolfi@yahoo.it>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Sort Phrases
Date: Mon, 22 Oct 2012 23:44:49 +0530	[thread overview]
Message-ID: <CAL1SgUq4AQN95un_e_yD0vPnObQN1tG_hS49i5JWRKZgYmA8Jg@mail.gmail.com> (raw)
In-Reply-To: <1350906016.77719.YahooMailNeo@web29804.mail.ird.yahoo.com>

[-- Attachment #1: Type: text/plain, Size: 2038 bytes --]

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
>
>

[-- Attachment #2: Type: text/html, Size: 2893 bytes --]

  reply	other threads:[~2012-10-22 18:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-22 11:27 Sort Phrases Sanjib Sikder
2012-10-22 11:40 ` Giovanni Ridolfi
2012-10-22 18:14   ` Sanjib Sikder [this message]
2012-10-22 18:18     ` Sanjib Sikder
2012-10-22 13:26 ` Nick Dokos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAL1SgUq4AQN95un_e_yD0vPnObQN1tG_hS49i5JWRKZgYmA8Jg@mail.gmail.com \
    --to=sanjibju2002@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=giovanni.ridolfi@yahoo.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).