Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.0
Date: Sun, 10 Jan 2016 19:59:43 +0000
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: backward-kill-shell-word widget
Message-ID: <20160110195943.GB11464@tarsus.local2>
References: <20160110003758.GA28696@tarsus.local2>
 <CAKc7PVBuSXQfu=cJZekc-nr-tFtk2dd1tzKL3x8GD0APKoNQQg@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAKc7PVBuSXQfu=cJZekc-nr-tFtk2dd1tzKL3x8GD0APKoNQQg@mail.gmail.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Seq: zsh-workers 37552

Sebastian Gniazdowski wrote on Sun, Jan 10, 2016 at 14:37:26 +0100:
> I see that you use (z) flag :) I think this is cool. I just was about
> to decide to bind shell-worded transpose-words-match to Alt-r (have
> transpose-segment bound to Alt-t) and noticed that I rather want to
> keep select-word-style bash. I rather want Ctrl-W to delete normal
> words. So with your function one can have:
> - "Ctrl-W" / backward-kill-word to delete word with style of his choice
> - transpose-words-match to swap words with style of his choice,
> keeping in mind to position cursor at beginning of the words
> - "Alt-m" / copy-prev-shell-word to copy shell word regardless of word style
> - "Ctrl-T" / backward-kill-shell-word to delete shell word regardless
> of word style
> - "Alt-t" / my transpose-segment to swap shell words regardless of
> word style (should I rename the widget to "transpose-shell-word",
> looks like yes)
> - "Alt-/" / _history-complete-older to complete shell words regardless
> of word style
> 
> I think this goes into a nice workbench for quick manipulation of
> command line, if one devotes time to establish order in that set of
> loosely coupled functionalities.

Don't put too much weight on my choice of <C-T> for b-k-s-word.  It's
not my preferred choice for b-k-s-word, it's simply the chord I always
use for testing widgets.

As to the general issue, I'd consider some more systematic approach.  Vi
has its operators; you could have something similar by having a "prefix
key" that chooses the word style: e.g., <C-T><w> or <C-T><C-W> would
"delete a shell word backwards", <C-Y><w> or <C-Y><C-W> would "delete
a whitespace-separated word backwards", and plain <C-W> would delete
a default-styled word backwards.

And of course a NUMERIC could be prepended to any of those, just as with
vi operators.

How does emacs handle this issue?  Does emacs have different chords for
different kinds of "delete a word backwards"?

