From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) Newsgroups: gmane.emacs.devel Subject: Re: electric-pair-mode as a minor mode? Date: Sun, 29 Mar 2015 21:41:30 +0100 Message-ID: References: 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 1427661714 2569 80.91.229.3 (29 Mar 2015 20:41:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 29 Mar 2015 20:41:54 +0000 (UTC) Cc: Yuri D'Elia , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 29 22:41:53 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 1YcK1g-0003JC-SC for ged-emacs-devel@m.gmane.org; Sun, 29 Mar 2015 22:41:45 +0200 Original-Received: from localhost ([::1]:58147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcK1g-0007r9-78 for ged-emacs-devel@m.gmane.org; Sun, 29 Mar 2015 16:41:44 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcK1b-0007qb-Hc for emacs-devel@gnu.org; Sun, 29 Mar 2015 16:41:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YcK1X-0001oo-GX for emacs-devel@gnu.org; Sun, 29 Mar 2015 16:41:39 -0400 Original-Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:32974) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcK1X-0001oh-9z for emacs-devel@gnu.org; Sun, 29 Mar 2015 16:41:35 -0400 Original-Received: by wixm2 with SMTP id m2so70718989wix.0 for ; Sun, 29 Mar 2015 13:41:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=ShtXfl2DNsGjYa4oR7q+zkD5Tn0q3f6juWCgOUDHI0A=; b=fjzH/XI38qM7I4fdyX2pSa7yZHDp6iNhHclOac46A7dyXdQSEYApaqW+qNhmJMKZi4 hPZnFhGWw2iGL+Nl2B8dpKWLwuyzYn1CvOzvVT8XJqsbz0mc/Lr7RUbaTN8xqvaDgOZE sv/xgzkzrPZXkNWgklrtamYT0vtU5v9gz9+B7aTpbw/TBaNxIYOiBQb74E7Vw6fk1OKR UUU+WHKmdSwWmPpVEOn+39an2H+VP/O2LcbRn7SL2onTBpUl/rE+GYpoUJttq2g+unt6 2pLRugNdL5sAxQJTyrxS7CZotkn7n0bVRS5keQJxKQ+qk+A+3EfSyqt7B2tetPn0SD/W Q+0Q== X-Received: by 10.180.12.194 with SMTP id a2mr16219933wic.55.1427661693933; Sun, 29 Mar 2015 13:41:33 -0700 (PDT) Original-Received: from king.yourcompany.com (31.57.37.188.rev.vodafone.pt. [188.37.57.31]) by mx.google.com with ESMTPSA id fm10sm12654705wib.7.2015.03.29.13.41.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Mar 2015 13:41:32 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sun, 29 Mar 2015 00:01:05 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (darwin) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::235 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:184525 Archived-At: Stefan Monnier writes: > It might be a good idea to do it in general (i.e. not as part of > electric-pair-mode but as part of message-mode for example).=20=20 Yes, that's what I meant. This hack: (modify-syntax-entry ?> "< " message-mode-syntax-table) (modify-syntax-entry ?\n "> " message-mode-syntax-table) (add-hook 'message-mode-hook (lambda () (setq-local parse-sexp-ignore-comments t))) could go somewhere into lisp/message.el if it weren't so fragile: the comment syntax could change according to `message-yank-cited-prefix' and also I has to be a comment only if it starts in the first column... Do you follow? Know any way to handle these cases? > doesn't change the fact that syntax-ppss is unreliable. they're > ...=20 > correct. But for natural language, there's no such perfection. very > ... > dependent on specific conventions used by people, which change > significantly between communities). Yes, yes and yes. Of course in natural languages there's no compiler formally telling you the message is unsyntactic, but I personally will go for a tool that gets it right almost everytime (some value between 90% and 100%), as long as the price when it gets it wrong is not too high. And simple syntax changes to help the syntax-ppss heuristic are the low-hanging fruit. >> (add-hook 'text-mode-hook >> (lambda () (setq-local electric-pair-preserve-balance nil))) > Ah, that might do it, indeed. At least a quick experiment seems to > handle the cases I mentioned so far. Not suprising considering that brings back precisely your old implementation :-) (oh no an unpaired smiley!) Jo=C3=A3o=20