From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [patch] make electric-pair-mode smarter/more useful Date: Mon, 16 Dec 2013 13:40:39 -0500 Message-ID: References: <87haalh806.fsf@gmail.com> <87ppp2ydqf.fsf@gmail.com> <87r49h7eby.fsf@gmail.com> <87ppoxepfj.fsf@gmail.com> <87fvps98qs.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1387219265 30147 80.91.229.3 (16 Dec 2013 18:41:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 16 Dec 2013 18:41:05 +0000 (UTC) Cc: emacs-devel@gnu.org To: joaotavora@gmail.com (=?windows-1252?B?Sm/jbyBU4XZvcmE=?=) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 16 19:41:10 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 1Vsd6K-0002yc-DB for ged-emacs-devel@m.gmane.org; Mon, 16 Dec 2013 19:41:08 +0100 Original-Received: from localhost ([::1]:57676 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vsd6K-0005MZ-2C for ged-emacs-devel@m.gmane.org; Mon, 16 Dec 2013 13:41:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vsd62-00052x-ML for emacs-devel@gnu.org; Mon, 16 Dec 2013 13:40:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vsd5v-0007N2-BY for emacs-devel@gnu.org; Mon, 16 Dec 2013 13:40:50 -0500 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:44849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vsd5u-0007Mo-Ll for emacs-devel@gnu.org; Mon, 16 Dec 2013 13:40:43 -0500 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.DIT.UMontreal.CA (8.14.1/8.14.1) with ESMTP id rBGIedrX009867; Mon, 16 Dec 2013 13:40:40 -0500 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id C574EAE2BE; Mon, 16 Dec 2013 13:40:39 -0500 (EST) In-Reply-To: (Stefan Monnier's message of "Mon, 16 Dec 2013 10:30:07 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4794=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4794> : inlines <329> : streams <1091798> : uri <1625918> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 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:166501 Archived-At: >> OK. So Emacs -Q, M-x electric-pair-mode and then in the scratch buffer >> go to some place in the comment's text and type a double quote. You get >> it autopaired. If you type it again you get a skip. OK. >> Now go back to the first quote and type it again. You get a skip. In my >> opinion, not so nice. Delete the first quote, go back some words and >> type another quote. You'll get an unbalanced string inside the >> comment. Again not so nice. >> Now if you do (setq electric-pair-text-syntax-table >> prog-mode-syntax-table) and repeat the second paragraph, you'll get >> results that I personally think are nicer. >> BTW these are exactly the results that you mostly loose if you do the >> `electric-pair--looking-at-mismatched-string-p' simplification above. IIUC the difference between prog-mode-syntax-table and text-mode-syntax-table is the syntax of ". I see what you mean, and it's probably true that the problems with making " have string-syntax in text-mode don't apply here, so we're better off using a syntax-table where " has string-syntax. Stefan