From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jari Aalto Newsgroups: gmane.emacs.devel Subject: [RFC] trim.el -- Functions to delete extra whitespace Date: Tue, 12 Feb 2008 13:53:41 +0200 Organization: Private Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1202817266 10819 80.91.229.12 (12 Feb 2008 11:54:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 Feb 2008 11:54:26 +0000 (UTC) Cc: "Sean MacLennan - trim.el" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 12 12:54:49 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JOtim-0000V6-NW for ged-emacs-devel@m.gmane.org; Tue, 12 Feb 2008 12:54:45 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JOtiJ-0007fh-5t for ged-emacs-devel@m.gmane.org; Tue, 12 Feb 2008 06:54:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JOtiD-0007d3-BO for emacs-devel@gnu.org; Tue, 12 Feb 2008 06:54:09 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JOti8-0007Ye-NA for emacs-devel@gnu.org; Tue, 12 Feb 2008 06:54:09 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JOti8-0007Ya-HJ for emacs-devel@gnu.org; Tue, 12 Feb 2008 06:54:04 -0500 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JOti8-0007rx-4g for emacs-devel@gnu.org; Tue, 12 Feb 2008 06:54:04 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1JOti3-0005el-91 for emacs-devel@gnu.org; Tue, 12 Feb 2008 11:53:59 +0000 Original-Received: from a91-155-178-181.elisa-laajakaista.fi ([91.155.178.181]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 12 Feb 2008 11:53:59 +0000 Original-Received: from jari.aalto by a91-155-178-181.elisa-laajakaista.fi with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 12 Feb 2008 11:53:59 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 42 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: a91-155-178-181.elisa-laajakaista.fi User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (windows-nt) Cancel-Lock: sha1:iCdOrg7Nf2L2rzospEBQCTyFxY4= X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:88853 Archived-At: I'd lke to suggest adding trim.el to the distribution. It provides handy functions to fix buffer's/region's whitespace problems. The code is GPL Jari http://xemacs.seanm.ca/lisp/trim.el ----------------------------------------------------------------------- trim Function: Searches for `regexp' and deletes any matches. If optional arg `replace' is set, it replaces the match. If the region is active, only trims the lines in the region. trim-lines Function: Trim whitespace (including CR) from the ends of all lines. If the region is active, only trims the lines in the region. trim-empty-lines Function: Trim all empty lines. An empty line is a line with only whitespace (space, tab, CR) characters. If the region is active, only trims the lines in the region. trim-spaces Function: Trim all sequences of spaces to one space. If the region is active, only trims the lines in the region. trim-leading-spaces Function: Trim all white space at the starts of lines. If the region is active, only trims the lines in the region. trim-defines Function: Trim `#define' lines to isolate the `identifier'. If the region is active, only trims the lines in the region. untrim-lines Function: Add ^M to the end of all lines. If the region is active, only untrims the lines in the region.