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: Fri, 02 Jan 2015 15:39:36 +0100 Message-ID: <87ppaxmel3.fsf@wmi.amu.edu.pl> References: <8761drazec.fsf@wmi.amu.edu.pl> <87k318npmf.fsf@wmi.amu.edu.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1420209608 25282 80.91.229.3 (2 Jan 2015 14:40:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 2 Jan 2015 14:40:08 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 02 15:40:01 2015 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 1Y73OT-0000Vj-JH for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Jan 2015 15:40:01 +0100 Original-Received: from localhost ([::1]:51538 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y73OT-0002n6-1h for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Jan 2015 09:40:01 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y73OH-0002mx-Gm for help-gnu-emacs@gnu.org; Fri, 02 Jan 2015 09:39:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y73OD-0005k0-C3 for help-gnu-emacs@gnu.org; Fri, 02 Jan 2015 09:39:49 -0500 Original-Received: from msg.wmi.amu.edu.pl ([2001:808:114:2::50]:39828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y73OD-0005jf-57 for help-gnu-emacs@gnu.org; Fri, 02 Jan 2015 09:39:45 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by msg.wmi.amu.edu.pl (Postfix) with ESMTP id 1E6AF414C7 for ; Fri, 2 Jan 2015 15:39:42 +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 ls2YnUbGZlju for ; Fri, 2 Jan 2015 15:39:42 +0100 (CET) Original-Received: from localhost (unknown [150.254.75.184]) by msg.wmi.amu.edu.pl (Postfix) with ESMTPSA id E5B0542061 for ; Fri, 2 Jan 2015 15:39:41 +0100 (CET) In-reply-to: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:808:114:2::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:101831 Archived-At: On 2015-01-01, at 18:07, Stefan Monnier wrote: >> (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)))) > > You can also use > > (syntax-propertize-rules (smiley-regex (0 "."))) OK, so I started reading about this. I can see that syntax-propertize-rules is a huuuge macro I'm afraid even to look at from distance;-). Do I get it correctly that it "outputs" a function, so that I can write (setq syntax-propertize-function (syntax-propertize-rules (...))) ? >> (defun enable-smileys-punctuation () >> (setq syntax-propertize-function #'make-smileys-punctuation) > > Beware: syntax-propertize-function might already be in use, in which > case you should probably use add-function to combine the two. Yes, I know that; I wanted just to experiment a bit to start with. > Right, syntax-propertization is done lazily, so if nothing calls > syntax-propertize, then that's that. Usually the main triggers for > syntax-propertize are syntax-ppss and font-lock, but neither is likely > to be used in text-mode. So you'll probably need to arrange for font-lock to > be enabled *and* for font-lock-keywords-only not to be set to t. I have global font lock mode, so font locking is on everywhere. >> but then again, not in message mode, for instance. > > Probably because font-lock-keywords-only is set to t, so font-lock > doesn't end up calling syntax-ppss. Now that is strange: it seems that font-lock-keywords-only is set to t in mu4e-message mode (where I'm now), but grepping through mu4e sources didn't give any results (nor did isearching message.el). I'll have to look into this further (check other modes etc.) > Stefan Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University