From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mike Mattie Newsgroups: gmane.emacs.help Subject: Re: Help with keybinding to delete between {} Date: Wed, 12 Dec 2007 19:59:16 -0800 Message-ID: <20071212195916.32d63920@reforged> References: <598472b5-c766-483a-93e5-15b31bfd880f@b40g2000prf.googlegroups.com> <922740c0-88f0-42c0-a373-d7a28c354c4a@s12g2000prg.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0853111017==" X-Trace: ger.gmane.org 1197518667 3142 80.91.229.12 (13 Dec 2007 04:04:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Dec 2007 04:04:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 13 05:04:37 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 1J2fJN-00027A-8X for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Dec 2007 05:04:37 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J2fJ5-00063h-6o for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Dec 2007 23:04:19 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J2fIn-00061g-2e for help-gnu-emacs@gnu.org; Wed, 12 Dec 2007 23:04:01 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J2fIl-0005yt-CS for help-gnu-emacs@gnu.org; Wed, 12 Dec 2007 23:04:00 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J2fIl-0005yd-7f for help-gnu-emacs@gnu.org; Wed, 12 Dec 2007 23:03:59 -0500 Original-Received: from wa-out-1112.google.com ([209.85.146.179]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J2fIk-0005jR-NO for help-gnu-emacs@gnu.org; Wed, 12 Dec 2007 23:03:58 -0500 Original-Received: by wa-out-1112.google.com with SMTP id k34so819101wah.10 for ; Wed, 12 Dec 2007 20:03:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject:message-id:in-reply-to:references:x-mailer:mime-version:content-type; bh=XtIYE1mqELtus4oKDhcQbHI4LqJK0x0MH7rDgTTsxMc=; b=MYtTXjKIp5qb7Aiy/B1ujIVNADtqEBqSYN9b0HT3cZ5h7X947dRtJKf1rZVZn8BjujJL91Va6b+l1Q66IDabHMNqIMaF7y6TMZi19GC2vPNm5HLo4FxBQuzmJ/gGnxT2SEnbyK1NTVJ1oTV1nx210lB7kVjhVoZO5ktee1UaMcI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:in-reply-to:references:x-mailer:mime-version:content-type; b=XV/tfZm6OaVcpSkz0QjqbQKrtzw6PDhT38eQRK1lu4fzVkurbFMFAHgdkLMdBJbLe7lMaV8mywe0xE3Xq5Bs8Ix5Vf4ub1zH4GbyFxdJnXoT8egg/zPyen7gRfg0APnb+JlPxhyL61SFZ27Pv1OZUfL84LL8oOvHI/GJiX6pNw4= Original-Received: by 10.114.75.1 with SMTP id x1mr1677484waa.137.1197518636781; Wed, 12 Dec 2007 20:03:56 -0800 (PST) Original-Received: from reforged ( [71.217.198.62]) by mx.google.com with ESMTPS id k21sm9525332waf.2007.12.12.20.03.55 (version=SSLv3 cipher=OTHER); Wed, 12 Dec 2007 20:03:56 -0800 (PST) In-Reply-To: X-Mailer: Claws Mail 3.0.0 (GTK+ 2.12.1; i686-pc-linux-gnu) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) 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:50056 Archived-At: --===============0853111017== Content-Type: multipart/signed; boundary="Sig_WZ=MF196KvML99hkqus.gjB"; protocol="application/pgp-signature"; micalg=PGP-SHA1 --Sig_WZ=MF196KvML99hkqus.gjB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, 6 Dec 2007 09:14:12 -0800 (PST) Xah Lee wrote: > for some reason my code in the previous post is completely non- > functional. (i swear i used it for few months. Perhaps when i put on > the website i got smart and edited it "for the better" without > testing) >=20 > Here's the correct version: >=20 > (defun delete-enclosed-text () > "Delete texts between any pair of delimiters. > Note: if you have nested matching pairs, the cursor > should be inside the inner most one. Else it gets confused. > This code should to be fixed in the future." > (interactive) > (save-excursion > (let (p1 p2) > (skip-chars-backward "^(<["<<") (setq p1 (point)) > (skip-chars-forward "^)>]">>") (setq p2 (point)) > (delete-region p1 p2) > ) > ) > ) I don't this this can be right. on a single line it has three string quotat= ion characters. (defun delete-enclosed-text () "Delete texts between any pair of delimiters. Note: if you have nested matching pairs, the cursor should be inside the inner most one. Else it gets confused. This code should to be fixed in the future." (interactive) (skip-chars-forward "^)>>") (delete-backward-char (skip-chars-backward "^(<<"))) this version doesn't change the mark so I dropped the save-excursion. It is= not quite right because it does not handle nested sexp at all. I don't understand the elisp flavor = of regex yet, so it's probably an easy fix. > Xah > xah@xahlee.org > =E2=88=91 http://xahlee.org/ > _______________________________________________ > help-gnu-emacs mailing list > help-gnu-emacs@gnu.org > http://lists.gnu.org/mailman/listinfo/help-gnu-emacs --Sig_WZ=MF196KvML99hkqus.gjB Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFHYK4edfRchrkBInkRAr+kAJwLpZoosCn7MPLJ4ZysSC5Tkovu5gCeLuIi Pi8hTyTCOp1ufZhHrf+l4R4= =Ypp0 -----END PGP SIGNATURE----- --Sig_WZ=MF196KvML99hkqus.gjB-- --===============0853111017== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ help-gnu-emacs mailing list help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs --===============0853111017==--