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: Thu, 01 Jan 2015 22:41:15 +0100 Message-ID: <87387udvr8.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 1420148512 32090 80.91.229.3 (1 Jan 2015 21:41:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 1 Jan 2015 21:41:52 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 01 22:41:47 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 1Y6nV2-0003O3-9G for geh-help-gnu-emacs@m.gmane.org; Thu, 01 Jan 2015 22:41:44 +0100 Original-Received: from localhost ([::1]:49671 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6nV1-00067Z-LZ for geh-help-gnu-emacs@m.gmane.org; Thu, 01 Jan 2015 16:41:43 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45770) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6nUp-00066d-U1 for help-gnu-emacs@gnu.org; Thu, 01 Jan 2015 16:41:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y6nUm-0007Qs-Mv for help-gnu-emacs@gnu.org; Thu, 01 Jan 2015 16:41:31 -0500 Original-Received: from msg.wmi.amu.edu.pl ([2001:808:114:2::50]:40938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6nUm-0007Qf-Cf for help-gnu-emacs@gnu.org; Thu, 01 Jan 2015 16:41:28 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by msg.wmi.amu.edu.pl (Postfix) with ESMTP id B96A0414BF for ; Thu, 1 Jan 2015 22:41:25 +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 hsg1-IexZ2pn for ; Thu, 1 Jan 2015 22:41:25 +0100 (CET) Original-Received: from localhost (117-116.echostar.pl [213.156.117.116]) by msg.wmi.amu.edu.pl (Postfix) with ESMTPSA id 36CBC42061 for ; Thu, 1 Jan 2015 22:41:25 +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:101825 Archived-At: On 2015-01-01, at 18:07, Stefan Monnier wrote: > You can also use > > (syntax-propertize-rules (smiley-regex (0 "."))) Thanks, I didn't know about this function. Very handy. >> (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. Hm. My Emacs (24.3) doesn't have anything called add-function. I checked on the interwebs, and it seems it's part of the new advice system. I'll have to upgrade finally. My question: wouldn't it be reasonable to change syntax-propertize-function into a /list/ of functions? Right now the manual says that it should be set up by major mode to achieve some special effects. In my case, however, it would be more appropriate to use a minor mode (possibly even a global minor mode). Wouldn't syntax-propertize-functions be more appropriate here? OTOH, one your answer on Emacs.SE says explicitly that the trend is to go away from "-functions" and use "-function" instead. What is the rationale? Do I guess correctly that it will be easier to /remove/ things added this way? >> (setq parse-sexp-lookup-properties t)) > > This is not necessary, it will be set by the syntax-propertize function. I checked it, and I see it's even better, it will make it buffer-local. Again: very handy. BTW: do I guess correctly that the reason that parse-sexp-lookup-properties is nil by default (and the reason for its existence in the first place) is performance issues? If yes, is the difference between having it nil and t substantial on modern hardware? >> However, it did not work (in text mode); my make-smileys-punctuation >> seems not even to get called. > > 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. Well, I did not understand everything you wrote here. I guess I will just have to RTFM; I vaguely remember reading about "lazy font-lock" 15 years ago, when I was reading (almost) the whole Emacs manual. I guess this is something similar. I'll write back to the list if I don't get it from the manual. >> 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. Yes it is, though I don't (yet) understand what this means. See above. > Stefan PS. I guess that I will have to turn the knowledge from this exchange to a lengthy blog post. As I said in some other thread: I've been using Emacs for about 15 years now (which is not much by Emacs standards, but /a lot/ by so-called /modern/ standards), and still learning /a lot/... Thank you so much! -- Marcin Borkowski This email was proudly sent http://mbork.pl from my Emacs.