unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [RFC] trim.el -- Functions to delete extra whitespace
@ 2008-02-12 11:53 Jari Aalto
  2008-02-12 14:35 ` Dan Nicolaescu
  0 siblings, 1 reply; 6+ messages in thread
From: Jari Aalto @ 2008-02-12 11:53 UTC (permalink / raw)
  To: emacs-devel; +Cc: Sean MacLennan - trim.el


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.






^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] trim.el -- Functions to delete extra whitespace
  2008-02-12 11:53 [RFC] trim.el -- Functions to delete extra whitespace Jari Aalto
@ 2008-02-12 14:35 ` Dan Nicolaescu
  2008-02-16  3:50   ` Vinicius Jose Latorre
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Nicolaescu @ 2008-02-12 14:35 UTC (permalink / raw)
  To: Jari Aalto; +Cc: Sean MacLennan - trim.el, emacs-devel

Jari Aalto <jari.aalto@cante.net> writes:

  > I'd lke to suggest adding trim.el to the distribution. It provides
  > handy functions to fix buffer's/region's whitespace problems.

Does it provide anything that emacs/lisp/whitespace.el in CVS HEAD does
not provide?  If yes, then can the code be integrated in whitespace.el?
It's not desirable for users to have to learn about 2 different packages
to get very closely related functionality.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] trim.el -- Functions to delete extra whitespace
  2008-02-12 14:35 ` Dan Nicolaescu
@ 2008-02-16  3:50   ` Vinicius Jose Latorre
  2008-02-17 13:22     ` Richard Stallman
  2008-02-17 16:30     ` Dan Nicolaescu
  0 siblings, 2 replies; 6+ messages in thread
From: Vinicius Jose Latorre @ 2008-02-16  3:50 UTC (permalink / raw)
  To: emacs-devel; +Cc: xemacs, jari.aalto


>   > I'd lke to suggest adding trim.el to the distribution. It provides
>   > handy functions to fix buffer's/region's whitespace problems.
>
> Does it provide anything that emacs/lisp/whitespace.el in CVS HEAD does
> not provide?  If yes, then can the code be integrated in whitespace.el?
> It's not desirable for users to have to learn about 2 different packages
> to get very closely related functionality.
>   


Yes, there are some functionalities that whitespace.el doesn't have,
that is, trim-defines (well, is this function useful?) and untrim-lines.
Both functions can be implemented in whitespace.el.

trim-spaces seems like just-one-space function.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] trim.el -- Functions to delete extra whitespace
  2008-02-16  3:50   ` Vinicius Jose Latorre
@ 2008-02-17 13:22     ` Richard Stallman
  2008-02-17 17:20       ` Vinicius Jose Latorre
  2008-02-17 16:30     ` Dan Nicolaescu
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2008-02-17 13:22 UTC (permalink / raw)
  To: Vinicius Jose Latorre; +Cc: xemacs, jari.aalto, emacs-devel

    Yes, there are some functionalities that whitespace.el doesn't have,
    that is, trim-defines (well, is this function useful?) and untrim-lines.
    Both functions can be implemented in whitespace.el.

Please make the useful extensions suggested by trim.el.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] trim.el -- Functions to delete extra whitespace
  2008-02-16  3:50   ` Vinicius Jose Latorre
  2008-02-17 13:22     ` Richard Stallman
@ 2008-02-17 16:30     ` Dan Nicolaescu
  1 sibling, 0 replies; 6+ messages in thread
From: Dan Nicolaescu @ 2008-02-17 16:30 UTC (permalink / raw)
  To: Vinicius Jose Latorre; +Cc: xemacs, jari.aalto, emacs-devel

Vinicius Jose Latorre <viniciusjl@ig.com.br> writes:

  > >   > I'd lke to suggest adding trim.el to the distribution. It provides
  > >   > handy functions to fix buffer's/region's whitespace problems.
  > >
  > > Does it provide anything that emacs/lisp/whitespace.el in CVS HEAD does
  > > not provide?  If yes, then can the code be integrated in whitespace.el?
  > > It's not desirable for users to have to learn about 2 different packages
  > > to get very closely related functionality.
  > >   
  > 
  > 
  > Yes, there are some functionalities that whitespace.el doesn't have,
  > that is, trim-defines (well, is this function useful?) 

IMHO it is not.  What is the point of this function?

  > and untrim-lines.

The name of this function is confusing, and what it does is to add ^M at
the end of each line in the region.  Not useful.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] trim.el -- Functions to delete extra whitespace
  2008-02-17 13:22     ` Richard Stallman
@ 2008-02-17 17:20       ` Vinicius Jose Latorre
  0 siblings, 0 replies; 6+ messages in thread
From: Vinicius Jose Latorre @ 2008-02-17 17:20 UTC (permalink / raw)
  To: rms; +Cc: xemacs, jari.aalto, emacs-devel


>     Yes, there are some functionalities that whitespace.el doesn't have,
>     that is, trim-defines (well, is this function useful?) and untrim-lines.
>     Both functions can be implemented in whitespace.el.
>
> Please make the useful extensions suggested by trim.el.
>   

Well, I agree with Dan Nicolaescu that these functions are not so useful.

trim-defines seems to have a very specific usage.

untrim-lines only adds ^M at end of each line.
It seems the only usage should be to deal with CR LF for Windows text files,
probably when Emacs didn't deal with end of line depending on the 
environment,
that is, a very very long time ago.

All other functions are already implemented in whitespace.el,
except trim-spaces which seems to be a variant of just-one-space function.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-02-17 17:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-12 11:53 [RFC] trim.el -- Functions to delete extra whitespace Jari Aalto
2008-02-12 14:35 ` Dan Nicolaescu
2008-02-16  3:50   ` Vinicius Jose Latorre
2008-02-17 13:22     ` Richard Stallman
2008-02-17 17:20       ` Vinicius Jose Latorre
2008-02-17 16:30     ` Dan Nicolaescu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).