From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marco Maggesi Newsgroups: gmane.emacs.help Subject: Question on syntax-propertize-function Date: Thu, 6 Jun 2013 12:26:28 -0700 (PDT) Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1370547071 32069 80.91.229.3 (6 Jun 2013 19:31:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Jun 2013 19:31:11 +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 Jun 06 21:31:14 2013 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 1Ukftv-0005oq-Gc for geh-help-gnu-emacs@m.gmane.org; Thu, 06 Jun 2013 21:31:11 +0200 Original-Received: from localhost ([::1]:59390 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ukftv-0000F3-4d for geh-help-gnu-emacs@m.gmane.org; Thu, 06 Jun 2013 15:31:11 -0400 X-Received: by 10.224.200.202 with SMTP id ex10mr21880198qab.8.1370546789438; Thu, 06 Jun 2013 12:26:29 -0700 (PDT) X-Received: by 10.49.82.16 with SMTP id e16mr415065qey.13.1370546788807; Thu, 06 Jun 2013 12:26:28 -0700 (PDT) Original-Path: usenet.stanford.edu!ch1no2748884qab.0!news-out.google.com!10ni333qax.0!nntp.google.com!c5no8001826pbj.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=87.21.133.225; posting-account=QU505AoAAAArB2KPiK2pKsNCkFaGvtey Original-NNTP-Posting-Host: 87.21.133.225 User-Agent: G2/1.0 Injection-Date: Thu, 06 Jun 2013 19:26:29 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:199091 X-Mailman-Approved-At: Thu, 06 Jun 2013 15:31:02 -0400 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:91358 Archived-At: Hi, I'm trying to improve an old emacs major mode I wrote some years ago (http:= //web.math.unifi.it/users/maggesi/holl-mode-2006-10-24.tar.gz) for editing = HOL Light proof scripts (HOL Light is a theorem prover http://www.cl.cam.ac= .uk/~jrh13/hol-light/, its syntax is close to OCaml and SML but with lots o= f idiosyncrasies). I have two problems: 1. Comments are delimited by (* and *). However, (*) should not open nor c= lose a comment. 2. Anything enclosed in blackquotes `...` is a HOL term and follows a diffe= rent syntax. I suppose that this kind of issues are normally solved by setting text prop= erties, but so far my attempts failed miserably. I left aside problem 2 fo= r now because I'm undecided on what to do exactly (e.g., should I set the s= yntax-table property for the quoted text or should I use syntax-entry "$ = "?). Here is what I did for problem 1. I set a syntax table for holl mode which= includes the following entries: (modify-syntax-entry ?\( "()1" st) (modify-syntax-entry ?\) ")(4" st) (modify-syntax-entry ?\* ". 23n" st) This works as expected in most cases, but (*) open and close comments. Then I defined a "propertize" function: (defun holl-syntax-propertize (start end) (goto-char start) (funcall (syntax-propertize-rules ("\\((\\)\\(\\*\\)\\()\\)" (1 "() ") (2 ". ") (3 ")( ")) ) start end)) and I set syntax-propertize-function in the initialization of the major mod= e: (set (make-local-variable 'syntax-propertize-function) #'holl-syntax-propertize) However, this doesn't seems to have any effect. I also played with syntax-= propertize-extend-region-functions but with no success. Can you see what's wrong with this approach? Or can you suggest a debuggin= g technique? E.g., how can I run interactively syntax-property-rules? I d= efined an interactive function (defun holl-propertize (start end) (interactive "r") (funcall (syntax-propertize-rules ("\\((\\)\\(\\*\\)\\()\\)" (1 "() ") (2 ". ") (3 ")( ")) ) start end)) and if I run it on a region containing (*) I get no effect. Thanks, Marco