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: electric-pair-mode as a minor mode? Date: Sun, 12 Apr 2015 07:56:46 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1428839830 7437 80.91.229.3 (12 Apr 2015 11:57:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 12 Apr 2015 11:57:10 +0000 (UTC) Cc: Yuri D'Elia , emacs-devel@gnu.org To: joaotavora@gmail.com (=?windows-1252?B?Sm/jbyBU4XZvcmE=?=), Lars Magne Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 12 13:57:02 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 1YhGVY-0000aC-En for ged-emacs-devel@m.gmane.org; Sun, 12 Apr 2015 13:57:00 +0200 Original-Received: from localhost ([::1]:44946 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhGVX-0004Dj-OU for ged-emacs-devel@m.gmane.org; Sun, 12 Apr 2015 07:56:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhGVU-0004Dd-T4 for emacs-devel@gnu.org; Sun, 12 Apr 2015 07:56:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YhGVQ-0005R7-S6 for emacs-devel@gnu.org; Sun, 12 Apr 2015 07:56:56 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:37770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhGVQ-0005R1-Lj for emacs-devel@gnu.org; Sun, 12 Apr 2015 07:56:52 -0400 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t3CBuls7012057; Sun, 12 Apr 2015 07:56:47 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id C59D3127B; Sun, 12 Apr 2015 07:56:46 -0400 (EDT) In-Reply-To: (=?windows-1252?Q?=22Jo=E3o_T=E1vo?= =?windows-1252?Q?ra=22's?= message of "Sat, 11 Apr 2015 17:06:27 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.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 RV5274=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5274> : inlines <2686> : streams <1421206> : uri <1904829> 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:185329 Archived-At: >> I think in the case of the smiley regexps, rather than mark them as >> comments, it's better to only change the parenthesis's syntax to be >> "punctuation". > Since Lars hasn't responded yet, here's an updated patch that addresses > the issues discussed so far. OK to install? [ Hmm.... I'd really like Lars's input on this. But it looks OK to me. ] > + (smiley-regexp (regexp-opt '(":-)" ":)" > + ":-(" ":(" > + ";-)" ";)")))) This list (and/or regexp) should be moved to a variable. > + (goto-char beg) > + (while (search-forward-regexp citation-regexp > + end 'noerror) > + (let ((start (match-beginning 0)) > + (end (match-end 0))) > + (add-text-properties start (1+ start) > + '(syntax-table (11 . nil))) I'd recommend you use the string for of syntax-specifiers, as in (string-to-syntax "<"). These are evaluated at compile-time, so it's efficient. > + (setq-local parse-sexp-lookup-properties t) This one is not needed. The syntax-propertize code should set it for you already. Stefan