From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.devel Subject: Re: Patch to change just-one-space Date: Thu, 13 Aug 2009 19:24:50 -0700 Message-ID: References: <7b501d5c0908131337g300e8895i465719007e29074c@mail.gmail.com> <7b501d5c0908131630j73f0cda2le909dfe7248d9516@mail.gmail.com> Reply-To: xahlee@gmail.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=00163646c8b0bb6185047110c182 X-Trace: ger.gmane.org 1250216714 508 80.91.229.12 (14 Aug 2009 02:25:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Aug 2009 02:25:14 +0000 (UTC) Cc: Emacs-Devel devel To: Deniz Dogan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 14 04:25:07 2009 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 1MbmTX-0005BC-6o for ged-emacs-devel@m.gmane.org; Fri, 14 Aug 2009 04:25:03 +0200 Original-Received: from localhost ([127.0.0.1]:36253 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbmTW-0001mk-DT for ged-emacs-devel@m.gmane.org; Thu, 13 Aug 2009 22:25:02 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MbmTS-0001mf-0O for emacs-devel@gnu.org; Thu, 13 Aug 2009 22:24:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MbmTM-0001mL-Kj for emacs-devel@gnu.org; Thu, 13 Aug 2009 22:24:56 -0400 Original-Received: from [199.232.76.173] (port=49484 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbmTM-0001mH-8d for emacs-devel@gnu.org; Thu, 13 Aug 2009 22:24:52 -0400 Original-Received: from mail-px0-f193.google.com ([209.85.216.193]:55078) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MbmTL-0000GP-PZ for emacs-devel@gnu.org; Thu, 13 Aug 2009 22:24:52 -0400 Original-Received: by pxi31 with SMTP id 31so175873pxi.24 for ; Thu, 13 Aug 2009 19:24:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=Or+uuUiK+XkYyHLRyspHALDijkG80gxM7cwc54QNfGE=; b=Wt3EB4FpBxSg1oMf5WXgoqOLZHegOCDjwxm/9H6xkxt19Hn5UK+jEHpNv0X9o1vcxP PAIJf6knry4HGME3ZUENdXLHOzFndNIOFIVsyVaft70xoO7IgLRvJZRGD/9C6xHEDba+ eC0hKncOX1unpuB3hIKlRbuWnfeEvpielTW1s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; b=g/ev9Yt0j0Fuzw9dg2DSj7cKANltx/T7aj9J+FdnXlFI3Ww7XJeeT3db1aM9/TNR+M kHaJ8k9lDQSQxM/PGZXvoZrNSR4c7UkscEc98YcxJ6azRrDgVRq9VmE1FuA+4BPRMr/p f+N2RB/EVzCC8bdsw99rENCRRoj3qKdLXN11w= Original-Received: by 10.114.153.12 with SMTP id a12mr1538763wae.25.1250216690540; Thu, 13 Aug 2009 19:24:50 -0700 (PDT) In-Reply-To: <7b501d5c0908131630j73f0cda2le909dfe7248d9516@mail.gmail.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:114217 Archived-At: --00163646c8b0bb6185047110c182 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, Aug 13, 2009 at 4:30 PM, Deniz Dogan wro= te: > 2009/8/14 Xah Lee : > > 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=3D0 > > for couple in findreplace: > > c numRep +=3D s.count(couple[0]) > > outtext=3Ds.replace(couple[0],couple[1]) > > s=3Douttext > > ----------------------------- > > where the c is the cursor point. > > If you shrink all whitespaces including EOL, the the current line becom= es > > 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-mod= e 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 =E2=98=84 --00163646c8b0bb6185047110c182 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On Thu, Aug 13, 2009 at 4:30 PM, Deniz D= ogan <den= iz.a.m.dogan@gmail.com> wrote:
2009/8/14 Xah Lee <xahlee@gmail.com<= /a>>:
> 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:
> -----------------------------
> =C2=A0=C2=A0 numRep=3D0
> =C2=A0=C2=A0 for couple in findreplace:
> c =C2=A0 =C2=A0numRep +=3D s.count(couple[0])
> =C2=A0=C2=A0 =C2=A0 =C2=A0outtext=3Ds.replace(couple[0],couple[1])
> =C2=A0=C2=A0 =C2=A0 =C2=A0s=3Douttext
> -----------------------------
> where the c is the cursor point.
> If you shrink all whitespaces including EOL, the the current line beco= mes
> joined with previous line.
> what i find more ideal is this:
> when the current line contain non-whitespace chars, then shrink just s= paces
> and tabs, but if the current line does not contain non-whitespace char= s
> (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 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 functio= ns for user convenience. One example i came to is about the 9 or so command= s on letter case changing. Some work on word, some on region... with transi= ent-mark-mode on now, the region versions could be merged. The lower case a= nd upper case and cap first versions can also be merged, i think, into one = dwim version that just cycles.

thanks.

=C2=A0=C2=A0Xah
<= div>=E2=98=84

--00163646c8b0bb6185047110c182--