From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ilya Zakharevich Newsgroups: gmane.emacs.help Subject: Re: Help with keybinding to delete between {} Date: Wed, 5 Dec 2007 23:50:20 +0000 (UTC) Organization: U.C. Berkeley Math. Department. Message-ID: References: <598472b5-c766-483a-93e5-15b31bfd880f@b40g2000prf.googlegroups.com> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1196901662 10085 80.91.229.12 (6 Dec 2007 00:41:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Dec 2007 00:41:02 +0000 (UTC) Bcc: ilya To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 06 01:41:12 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1J04nd-0007BF-Pp for geh-help-gnu-emacs@m.gmane.org; Thu, 06 Dec 2007 01:41:10 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J04nL-0002Jo-Us for geh-help-gnu-emacs@m.gmane.org; Wed, 05 Dec 2007 19:40:51 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!agate.berkeley.edu!ilya Original-Newsgroups: gnu.emacs.help Original-Lines: 40 Original-NNTP-Posting-Host: powdermilk.math.berkeley.edu Original-X-Trace: agate.berkeley.edu 1196898620 16246 169.229.140.13 (5 Dec 2007 23:50:20 GMT) Original-X-Complaints-To: usenet@agate.berkeley.edu Original-NNTP-Posting-Date: Wed, 5 Dec 2007 23:50:20 +0000 (UTC) User-Agent: trn [how to get a version via %-escapes???] with a custom header X-How-To-Reach-Me: The From: address is valid X-How-To-Disable-Cc: Put in the headers the line: Mail-Copies-To: never Originator: ilya@powdermilk.math.berkeley.edu Original-Xref: shelby.stanford.edu gnu.emacs.help:154444 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:49877 Archived-At: [A complimentary Cc of this posting was sent to lampshade ], who wrote in article <598472b5-c766-483a-93e5-15b31bfd880f@b40g2000prf.googlegroups.com>: > Hello, > > > I would really like a keybinding that would allow me to delete any > text between sexp's like {} (), etc no matter where I am between them > and whether or not that text has spaces. > > For example > {asdfdsfa asdfasdf asd} > I would like to delete between leaving only the {} with my cursor > inside ready to type. So far I've been trying > (defun delete_between () > (interactive) > (backward-sexp) (up-list -1) > (kill-sexp)) > (global-set-key [(control meta k)] 'delete_between) > > but that doesn't quite work. Anyone have any improvements or help > they could give me? In my setup, backspace kills back, delete forward; control-whatever acts in words; meta-left/right acts in sexps, meta-up/down does (up-list 1/-1). shift- adds some pepper (changes search-* to replace-*, changes kill-word to kill-up-to-begin/end-of-line, changes movement to move-and-modify-CUA-selection). But I do not have kill-by-sexp commands. Instead, I do a shifted-move (to select), and kill-CUA-selected. So to do what you want, I would M-up, S-M-right, S-backspace. More keystrokes, but much more flexible - I rarely want to delete something as simple as sexp, usually I combine several move-and-modify-CUA-selection commands... Probably this does not help your problem much... Ilya