From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Harry Putnam Newsgroups: gmane.emacs.devel Subject: Re: paren-close-dwim: elisp function of a newbie; feedback welcome Date: Fri, 27 Sep 2013 17:30:49 -0400 Organization: Still searching... Message-ID: <87siwqdkae.fsf@newsguy.com> 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 X-Trace: ger.gmane.org 1380317475 30763 80.91.229.3 (27 Sep 2013 21:31:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Sep 2013 21:31:15 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 27 23:31:18 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 1VPfd7-0005bC-7C for ged-emacs-devel@m.gmane.org; Fri, 27 Sep 2013 23:31:17 +0200 Original-Received: from localhost ([::1]:38601 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPfd6-0001hQ-Pq for ged-emacs-devel@m.gmane.org; Fri, 27 Sep 2013 17:31:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPfcy-0001gO-9k for emacs-devel@gnu.org; Fri, 27 Sep 2013 17:31:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPfcq-0003UH-VV for emacs-devel@gnu.org; Fri, 27 Sep 2013 17:31:08 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:58047) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPfcq-0003U5-Ow for emacs-devel@gnu.org; Fri, 27 Sep 2013 17:31:00 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VPfcp-0005KT-Je for emacs-devel@gnu.org; Fri, 27 Sep 2013 23:30:59 +0200 Original-Received: from z65-50-57-227.ips.direcpath.com ([65.50.57.227]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 Sep 2013 23:30:59 +0200 Original-Received: from reader by z65-50-57-227.ips.direcpath.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 Sep 2013 23:30:59 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 34 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: z65-50-57-227.ips.direcpath.com User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.0.92 (gnu/linux) Cancel-Lock: sha1:9viAzrYKVmbkE6Ze+gsJf5gN4hM= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:163690 Archived-At: Davis Herring writes: >>> (defun paren-close-dwim () >>> "Insert closing parenthesis from syntax table. >>> Use a normal parenthesis if not inside any." >>> (interactive "*") >>> (insert (or (ignore-errors >>> (save-excursion (backward-up-list) >>> (cdr (syntax-after (point))))) >>> ?\)))) >> >> I'm a total illiterate in elisp but the narrative so far sounds like a >> this code might do something really useful. >> >> Can someone describe briefly how this would work, maybe with a small >> example, when repairing my own perl code? > > 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 ([{<. It was actually a reference to something Florian said in OP: Florian wrote: >> . . . . . . . . . . . . For me this is much handier >> than using paren-mode or auto-pair etc, especially when modifying >> existing code." In my mind that registered as `repairing code'. > (If it is "really useful", know that it's not my idea; you just quoted > my reimplementation of Florian's code.) Thanks, yes, sorry... I actually meant to be replying to Florian's OP.