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 11:09:58 +0100 Message-ID: <87y4plcx3d.fsf@wmi.amu.edu.pl> References: <8761drazec.fsf@wmi.amu.edu.pl> <87k318npmf.fsf@wmi.amu.edu.pl> <87387udvr8.fsf@wmi.amu.edu.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1420193444 13815 80.91.229.3 (2 Jan 2015 10:10:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 2 Jan 2015 10:10:44 +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 11:10:39 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 1Y6zBk-0005cT-46 for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Jan 2015 11:10:36 +0100 Original-Received: from localhost ([::1]:50741 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6zBj-00027T-78 for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Jan 2015 05:10:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6zBL-00027N-Or for help-gnu-emacs@gnu.org; Fri, 02 Jan 2015 05:10:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y6zBI-00089J-7d for help-gnu-emacs@gnu.org; Fri, 02 Jan 2015 05:10:11 -0500 Original-Received: from msg.wmi.amu.edu.pl ([2001:808:114:2::50]:60080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y6zBH-00082d-UA for help-gnu-emacs@gnu.org; Fri, 02 Jan 2015 05:10:08 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by msg.wmi.amu.edu.pl (Postfix) with ESMTP id 45E4D414C3 for ; Fri, 2 Jan 2015 11:10:05 +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 6JUHFuspMLjR for ; Fri, 2 Jan 2015 11:10:05 +0100 (CET) Original-Received: from localhost (117-116.echostar.pl [213.156.117.116]) by msg.wmi.amu.edu.pl (Postfix) with ESMTPSA id A263A42061 for ; Fri, 2 Jan 2015 11:10:04 +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:101830 Archived-At: On 2015-01-02, at 05:07, Stefan Monnier wrote: >>> 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. > > Tho you probably only need this syntax-propertize-smileys thingy for > modes which don't use syntax-propertize-function yet, so maybe > add-function is not really necessary. Not sure if I understand. I don't need my smileys thing for programming modes =E2=80=93 here, smile= ys should appear only in strings/comments, and they don't do any harm there. Where I need it is mainly text, org, message and (la)tex modes. >> My question: wouldn't it be reasonable to change >> syntax-propertize-function into a /list/ of functions? > > At this point, it wouldn't be reasonable, no: add-function works as wel= l > already. Also, combining various functions there doesn't work quite as > easily as it sounds. For example, in your case, it works OK to put you= r > function before the major mode's function, but doing it the other way > around wouldn't always work right. For more general > syntax-propertize-functions, you can't just run them in turn. OK. >> 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? > > No, the difference is negligible. It's a historical left-over. That's what I thought, more or less. >>>> 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 likel= y >>> 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" 1= 5 >> years ago, > > This is unrelated. I used "lazy" in the general sense of "do things > as late as possible". I see. >>> 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= . > > This has to do with the way font-lock handles strings and comments > separately from other highlighting. In message-mode, this special > strings-and-comments highlighting is disabled, yet, that's the one that > normally triggers syntax-propertize. Again: I'll have to read the manual. > You could also use something like > > (defun my-call-syntax-propertize (limit) > (syntax-propertize limit) > (goto-char limit) > nil) > (font-lock-add-keywords nil '((my-call-syntax-propertize))) This idea might come in handy, since the next step is to mark smileys with gray;-). >> Thank you so much! > > My pleasure, > > Stefan Thanks again! --=20 Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University