From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.devel Subject: Re: parinfer-mode for Emacs might be neat for encouraging Lisp adoption Date: Fri, 13 Nov 2015 16:57:17 +0100 Message-ID: <87vb95opsy.fsf@mbork.pl> References: <877flow194.fsf@dustycloud.org> <871tbv4c9a.fsf@mbork.pl> <874mgq879a.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1447430263 5502 80.91.229.3 (13 Nov 2015 15:57:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Nov 2015 15:57:43 +0000 (UTC) Cc: Christopher Allan Webber , Oleh Krehel , Emacs developers To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 13 16:57:35 2015 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 1ZxGjG-0000VI-64 for ged-emacs-devel@m.gmane.org; Fri, 13 Nov 2015 16:57:34 +0100 Original-Received: from localhost ([::1]:53767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxGjF-00029l-MT for ged-emacs-devel@m.gmane.org; Fri, 13 Nov 2015 10:57:33 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxGjB-00026y-6s for emacs-devel@gnu.org; Fri, 13 Nov 2015 10:57:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxGj6-0008P1-Te for emacs-devel@gnu.org; Fri, 13 Nov 2015 10:57:29 -0500 Original-Received: from mail.mojserwer.eu ([2a01:5e00:2:52::8]:38222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxGj6-0008Op-Mq for emacs-devel@gnu.org; Fri, 13 Nov 2015 10:57:24 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 591288F2018; Fri, 13 Nov 2015 16:57:23 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VT2ou9S9gaME; Fri, 13 Nov 2015 16:57:21 +0100 (CET) Original-Received: from localhost (unknown [109.232.24.28]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 1DFB58F2017; Fri, 13 Nov 2015 16:57:21 +0100 (CET) User-agent: mu4e 0.9.15; emacs 25.0.50.1 In-reply-to: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a01:5e00:2:52::8 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:194380 Archived-At: On 2015-11-13, at 16:34, Jo=C3=A3o T=C3=A1vora wro= te: > Hi Oleh, Christopher, Marcin > > What do you think of this prototype? > > (defun joaot/setup-some-parinfer-fanciness () > (add-hook 'post-self-insert-hook 'joaot/reindent-up 'append 'loca= l)) > > (add-hook 'lisp-mode-hook 'joaot/setup-some-parinfer-fanciness) > > (defun joaot/reindent-up () > (ignore-errors > (save-excursion > (backward-up-list) (indent-sexp)))) > > Now in some lisp-mode, type > > (defun parinfer () > (let ((foo bar) > (baz quux)))) > > Change the `let' to `let*' and watch the auto-reindentation > magic. Probably very slow, but a cool trick nonetheless right? I'll try it later! > This is useful is other languages, right? Couldn't JSON benefit from > something like this too? > >> - It doesn't solve the problem of pasting unbalanced code. > > IMO the problem of pasting unbalanced code is best solved by leaving it > alone, and using `electric-pair-mode's paren-balancing heuristic (on by > default), which is like paredit, but without the restraining order. And > no need to learn new commands. BTW, lispy's M command also (kind of) solves that. > Have you tried it, Oleh? Any feelings on how it could be improved? > > Works for every language defining one or multiple parenthesis > syntaxes. Just like the hack above. > > Personally I haven't tried lispy, basically because I want uniform > interfaces for all languages, even non-programming ones. I don't want t= o > re-learn shortcuts when I switch from lisp to JSON. > > For that, I stick to, and am reasonably happy with, traditional sexp > navigation, the C-M-* family of movement/edition commands. Whoever came > up with those deserves some love. That is also a good point. (But I use lispy nevertheless.) Best, --=20 Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University