From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joaotavora@gmail.com (=?iso-8859-1?Q?Jo=E3o_T=E1vora?=) Newsgroups: gmane.emacs.devel Subject: Re: electric-pair-mode as a minor mode? Date: Fri, 27 Mar 2015 14:09:28 +0000 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1427465402 8081 80.91.229.3 (27 Mar 2015 14:10:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Mar 2015 14:10:02 +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 Fri Mar 27 15:09:57 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 1YbUxO-0005PO-6p for ged-emacs-devel@m.gmane.org; Fri, 27 Mar 2015 15:09:54 +0100 Original-Received: from localhost ([::1]:50389 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbUxN-000649-9w for ged-emacs-devel@m.gmane.org; Fri, 27 Mar 2015 10:09:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbUx6-000642-Pw for emacs-devel@gnu.org; Fri, 27 Mar 2015 10:09:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbUx2-00057u-Pb for emacs-devel@gnu.org; Fri, 27 Mar 2015 10:09:36 -0400 Original-Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]:33401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbUx2-00057c-I6 for emacs-devel@gnu.org; Fri, 27 Mar 2015 10:09:32 -0400 Original-Received: by wixm2 with SMTP id m2so35440313wix.0 for ; Fri, 27 Mar 2015 07:09:32 -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=8/5uNixaoFVCwPObMkxeExtaFo09QkRQeFyu5KPIg+s=; b=Cm9X8/CwpcTWsnmToubRzaeGpDspdaZJdQ2pwAW5i7KtQOSLLW0GdcThGhyrHV0tza vJFCljTiWdJhCwnvMKQJAKtKjdkkaSyyJilh6z8WgBPBJx+Bb+aFCNqAAIXF/MDsgm91 gutEqWUUI8lhFzclWUz2qVqYxQh7+ghA9PRqWBZVU6kbWqEHnSYgI8ny93cvxka1q5mO c/TGwaqyq5UCDVjAU+zgDI9DiIRIYzYFa7zsLb6d75U2qN/TCgsFyDXDMenoJsaa8867 lYzjqBVmd8/oB/+0frkDj/toJuB4FxefYLo5CfpoEws4cYmrC9OKYB0wzsAK1JTuD3J6 CoMQ== X-Received: by 10.194.78.114 with SMTP id a18mr39145492wjx.0.1427465372004; Fri, 27 Mar 2015 07:09:32 -0700 (PDT) Original-Received: from GONDOMAR.yourcompany.com (53.236.108.93.rev.vodafone.pt. [93.108.236.53]) by mx.google.com with ESMTPSA id dx11sm3020097wjb.23.2015.03.27.07.09.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Mar 2015 07:09:31 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Fri, 27 Mar 2015 09:25:49 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt) 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:184393 Archived-At: Stefan Monnier writes: > It's probably because of something in the context, but you can't assume > that parens are properly balanced in text mode. I don't, not directly. I just use whatever (syntax-table) says, as does `show-paren-mode' FWIW. And it says that text-mode buffers are all the same context and should have balanced parenthesis. Perhaps it shouldn't. > Here's one concrete example I bumped into earlier today: > > this is a sad example :-( > I just wanted to type foo ()) For every :-( there should be a :-), see? Seriously, while I won't stand in the way of having some `electric-pair-mode'-related default hookage in text-mode-hook, why isn't this fixed in text-mode's syntax-table? Aren't those wrong assumptions the real culprit? Do you want to recognize that the "sad example :-(" is in "a different context" than the function call foo(), and so should not be paired? If so, there's emacs machinery that separate those contexts (comment and non-comment) and `electric-pair-mode' can take that into consideration via `electric-pair-text-syntax-table'. But you obviously know this, so what do you have in mind? Jo=E3o