Re: [O] Sort Phrases

2012-10-22 Thread Sanjib Sikder
Hi Giovanni,

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

1. I am new in org-mode and emacs. Can you please tell me what is "sort
region" and what are the key bindings ?
2. Is there a way by which I can replace all the ',' with '\n' and do the
reverse automatically ?

Thanks.


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

*



On Mon, Oct 22, 2012 at 11:44 PM, Sanjib Sikder wrote:

> 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.rido...@yahoo.it> wrote:
>
>> Da: Sanjib Sikder 
>>
>> 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-linesin
>> 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
>>
>>
>


Re: [O] Sort Phrases

2012-10-22 Thread Sanjib Sikder
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  wrote:

> Da: Sanjib Sikder 
>
> 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-linesin 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
>
>


Re: [O] Sort Phrases

2012-10-22 Thread Giovanni Ridolfi
Da: Sanjib Sikder 

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




Re: [O] Sort Phrases

2012-10-22 Thread Nick Dokos
Sanjib Sikder  wrote:

> Hi,
> 
> I know it is possible to sort words and sort lines alphabetically in emacs 
> org-mode but is it
> possible to sort phrases ?
> 
> For example,
> 
> 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.
> 
> Is it possible ?
> 

Not with native org-mode facilities, I think.  It is possible of
course, but you would need to write your own elisp to do it.

Nick




[O] Sort Phrases

2012-10-22 Thread Sanjib Sikder
Hi,

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

For example,

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.


Is it possible ?

Thanks.

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

*