emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch to change just-one-space


From: Xah Lee
Subject: Re: Patch to change just-one-space
Date: Thu, 13 Aug 2009 19:24:50 -0700



On Thu, Aug 13, 2009 at 4:30 PM, Deniz Dogan <address@hidden> wrote:
2009/8/14 Xah Lee <address@hidden>:
> i share this view.
> though, in my experiment, i find that there are often situations where
> shrinking all whitespaces including EOL is not convenient. Here's a example:
> -----------------------------
>    numRep=0
>    for couple in findreplace:
> c    numRep += s.count(couple[0])
>       outtext=s.replace(couple[0],couple[1])
>       s=outtext
> -----------------------------
> where the c is the cursor point.
> If you shrink all whitespaces including EOL, the the current line becomes
> joined with previous line.
> what i find more ideal is this:
> when the current line contain non-whitespace chars, then shrink just spaces
> and tabs, but if the current line does not contain non-whitespace chars
> (it's all white space), then shrink all all spaces, tab, EOL.
> the code i've been using is this:
> [snip code]

Not a bad idea. I'd like to take your idea and revise it a bit: If
there are only whitespace characters characters between point and EOL,
nuke including newlines. Otherwise, nuke excluding newlines.

What do you think?

i think that'd bring the next non-whitespace line to the current line, right?

but in general, considering this thread in whole, i share your view with merging just-one-space with delete-blank-lines, and the behavior be depending on context. Something like a shrink-whitespace-dwim.

I feel there are too many small functions on shrinking white spaces, esp those with a shortcut.
e.g. C-x C-o for delete-blank-lines and just-one-space with M-SPC.

i think that these can be merged into a single dwim version with a single shortcut, because i think most of the time context can correctly guess the desired behavior.

i think this applies to few other emacs editing functions for user convenience. One example i came to is about the 9 or so commands on letter case changing. Some work on word, some on region... with transient-mark-mode on now, the region versions could be merged. The lower case and upper case and cap first versions can also be merged, i think, into one dwim version that just cycles.

thanks.

  Xah


reply via email to

[Prev in Thread] Current Thread [Next in Thread]