From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Florian Newsgroups: gmane.emacs.devel Subject: Re: paren-close-dwim: elisp function of a newbie; feedback welcome Date: Thu, 26 Sep 2013 22:44:16 +0200 Message-ID: <20130926204416.GA25292@csr-pc9.fritz.box> References: <20130925114643.GA7187@csr-pc9.zib.de> <52431E25.3030603@lanl.gov> <87txh7gxyt.fsf@newsguy.com> <52449B36.4080009@lanl.gov> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1380228282 9268 80.91.229.3 (26 Sep 2013 20:44:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 26 Sep 2013 20:44:42 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 26 22:44:45 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VPIQW-0003BS-5T for ged-emacs-devel@m.gmane.org; Thu, 26 Sep 2013 22:44:44 +0200 Original-Received: from localhost ([::1]:59857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPIQV-0007lS-EL for ged-emacs-devel@m.gmane.org; Thu, 26 Sep 2013 16:44:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPIQK-0007l4-ND for emacs-devel@gnu.org; Thu, 26 Sep 2013 16:44:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPIQA-0003Pu-Om for emacs-devel@gnu.org; Thu, 26 Sep 2013 16:44:32 -0400 Original-Received: from mail-ee0-x22a.google.com ([2a00:1450:4013:c00::22a]:55594) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPIQA-0003PI-I2 for emacs-devel@gnu.org; Thu, 26 Sep 2013 16:44:22 -0400 Original-Received: by mail-ee0-f42.google.com with SMTP id b45so823456eek.1 for ; Thu, 26 Sep 2013 13:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=1YO/MC/wT9UTyCShI6wH8sqF9EyT7SDQt+1Us27P7Xs=; b=jteHqU9o0Jyvo1HByajRd3uFVrpDWzx52e7bPst5tvrZql6hbecoZAmiGCY6TsNR1f hU7udrUR9QzVCc3ocvIXUgcMIoLdqIA1JDETWKHYZzfEv0lozCERJmiMjUgrTZ0a5yDz H568oTMoSCVe8I97Msm/TgOGRJyNzEeBQxBROjD3JfrcfONpeFtVEiHTjOkHHPaPsMTu 4i5sUldttuUmsPv0PNJCLJXeRAFmmL51A5an0J/zZgK2/dBMF1v7cRDuo0gB2TizrcFp If8QYhFyv7fV00NmiAHBtfAEWsltEIpO7cHIZlyWROTZ08/sG8X16iDLexbUDNBw7cqd oEJw== X-Received: by 10.14.126.69 with SMTP id a45mr134052eei.65.1380228257558; Thu, 26 Sep 2013 13:44:17 -0700 (PDT) Original-Received: from localhost (brln-4dbc7099.pool.mediaWays.net. [77.188.112.153]) by mx.google.com with ESMTPSA id f49sm8079144eec.7.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 13:44:17 -0700 (PDT) Content-Disposition: inline In-Reply-To: <52449B36.4080009@lanl.gov> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c00::22a X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:163666 Archived-At: > I'm not sure what you mean about "repairing ... code". This command > simply inserts ')', ']', or '}' (and perhaps '>' or so) to match the > most recent unclosed ([{<. > > (If it is "really useful", know that it's not my idea; you just quoted > my reimplementation of Florian's code.) But yours is much cleaner, I like it. Thanks for that. Here is a small example to illustrate what it does: If you are writing a nested expression, like the following, and '_' is your cursor, { (a * [(b) - (c) _ and you have bound ')' to paren-close-dwim (dwim = do what I mean), three succeeding presses of ')' will produce the sequence: ])}. Or in other words: ')' will produce the correct next matching closing bracket regarding the position of your cursor. Florian