[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Alphabetizing comma separated lists
From: |
Gregory J. Grubbs |
Subject: |
Re: Alphabetizing comma separated lists |
Date: |
Wed, 07 Oct 2009 21:38:25 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
James <ja.lira0@gmail.com> writes:
> For example, I want this:
> def, acb, lmn, ghi
>
> To appear like this:
> acb, def, ghi, lmn
>
> Is there a way to do this in Emacs?
>
> Any help would be appreciated,
> James
You could highlight the line or lines, then do
--8<---------------cut here---------------start------------->8---
M-: (sort-regexp-fields nil "[a-z]+" "\\&" (region-beginning) (region-end)) RET
--8<---------------cut here---------------end--------------->8---
The above splits the region into fields based on a regexp, and sorts it