From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: XKCD/541 compliance, anyone? Date: Wed, 31 Dec 2014 10:19:04 +0100 Message-ID: <87k318npmf.fsf@wmi.amu.edu.pl> References: <8761drazec.fsf@wmi.amu.edu.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1420017581 20315 80.91.229.3 (31 Dec 2014 09:19:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 31 Dec 2014 09:19:41 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 31 10:19:31 2014 Return-path: Envelope-to: geh-help-gnu-emacs@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 1Y6FRB-0003hq-FM for geh-help-gnu-emacs@m.gmane.org; Wed, 31 Dec 2014 10:19:29 +0100 Original-Received: from localhost ([::1]:39625 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6FRA-0006DM-3X for geh-help-gnu-emacs@m.gmane.org; Wed, 31 Dec 2014 04:19:28 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6FR0-0006DF-9c for help-gnu-emacs@gnu.org; Wed, 31 Dec 2014 04:19:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y6FQx-0008Ts-2O for help-gnu-emacs@gnu.org; Wed, 31 Dec 2014 04:19:18 -0500 Original-Received: from msg.wmi.amu.edu.pl ([150.254.78.50]:44532) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6FQw-0008Ta-Sb for help-gnu-emacs@gnu.org; Wed, 31 Dec 2014 04:19:15 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by msg.wmi.amu.edu.pl (Postfix) with ESMTP id 675CB414AF for ; Wed, 31 Dec 2014 10:19:13 +0100 (CET) Original-Received: from msg.wmi.amu.edu.pl ([127.0.0.1]) by localhost (msg.wmi.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id C4WaDpn+509o for ; Wed, 31 Dec 2014 10:19:13 +0100 (CET) Original-Received: from localhost (117-116.echostar.pl [213.156.117.116]) by msg.wmi.amu.edu.pl (Postfix) with ESMTPSA id E2C7F414AD for ; Wed, 31 Dec 2014 10:19:12 +0100 (CET) In-reply-to: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 150.254.78.50 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:101783 Archived-At: On 2014-12-04, at 23:34, Stefan Monnier wrote: >> I have a dream: to have the s-exp functions ignore closing parens, >> brackets etc. /after/, say, things matching > >> [;:B]-? > > You can use syntax-propertize-function to change the syntax class of > those parens. OK, so I did try. This is what I came up with: (defvar smiley-regex "[:;x>B][,']?-?[]()PD]" "This regex should match smileys.") (defun make-smileys-punctuation (beg end) "Look for smileys between BEG and END position in the buffer, and change their syntax property to punctuation." (goto-char beg) (while (re-search-forward smiley-regex end t) (put-text-property (match-beginning 0) (match-end 0) 'syntax-table '(1)))) (defun enable-smileys-punctuation () (setq syntax-propertize-function #'make-smileys-punctuation) (setq parse-sexp-lookup-properties t)) (add-hook 'text-mode-hook #'enable-smileys-punctuation) However, it did not work (in text mode); my make-smileys-punctuation seems not even to get called. Curiously enough, it seems to work in e.g. Elisp mode - but then again, not in message mode, for instance. What might be going on here? > Stefan Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University