From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen <ttn@gnuvola.org> Newsgroups: gmane.emacs.help Subject: Re: how to sort words in a line Date: Tue, 17 Jul 2007 21:20:03 +0200 Organization: sometimes Message-ID: <87ps2qsuqk.fsf@ambire.localdomain> References: <us0ni.4$Cn4.3848351@news.odn.de> <87r6n7l41m.fsf@thalassa.lan.informatimago.com> <f7ivtq$eo4$3@registered.motzarella.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1184701241 21175 80.91.229.12 (17 Jul 2007 19:40:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 17 Jul 2007 19:40:41 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 17 21:40:40 2007 Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org> Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IAsuU-0002Fy-PU for geh-help-gnu-emacs@m.gmane.org; Tue, 17 Jul 2007 21:40:39 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IAsuU-0002er-Q8 for geh-help-gnu-emacs@m.gmane.org; Tue, 17 Jul 2007 15:40:38 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-fra1.dfn.de!storethat.news.telefonica.de!telefonica.de!news.germany.com!news.banetele.no!uio.no!quimby.gnus.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 22 Original-NNTP-Posting-Host: ppp-138-32.21-151.libero.it Original-X-Trace: quimby.gnus.org 1184700022 4005 151.21.32.138 (17 Jul 2007 19:20:22 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: Tue, 17 Jul 2007 19:20:22 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) Cancel-Lock: sha1:SW0oKKDTXJFkPnEaBkoHB2vVsTE= Original-Xref: shelby.stanford.edu gnu.emacs.help:150180 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org> List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/help-gnu-emacs>, <mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe> List-Archive: <http://lists.gnu.org/pipermail/help-gnu-emacs> List-Post: <mailto:help-gnu-emacs@gnu.org> List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help> List-Subscribe: <http://lists.gnu.org/mailman/listinfo/help-gnu-emacs>, <mailto:help-gnu-emacs-request@gnu.org?subject=subscribe> Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:45765 Archived-At: <http://permalink.gmane.org/gmane.emacs.help/45765> () Rainer Stengele <rainer.stengele@online.de> () Tue, 17 Jul 2007 19:57:17 +0200 simple one-liner doing the work. perhaps one expression, nicely (readably) laid out, would please you: (defun sort-words-on-line () (interactive) (insert (mapconcat 'identity (sort (split-string (delete-and-extract-region (point) (1+ (line-end-position)))) 'string<) " ") "\n")) for this command to work, you have to be at bol and the line must end w/ newline. in exchange for these restrictions, it has the feature of moving you to the next line automatically (handy for kbd macro use). thi