From xemacs-m  Fri Jan  3 13:23:16 1997
Received: from plg.uwaterloo.ca (dmason@plg.uwaterloo.ca [129.97.140.10])
          by xemacs.cs.uiuc.edu (8.8.4/8.8.4) with ESMTP
	  id NAA03444 for <xemacs-beta@xemacs.org>; Fri, 3 Jan 1997 13:23:16 -0600 (CST)
Received: (from dmason@localhost) by plg.uwaterloo.ca (8.7.6/8.7.3) id OAA08967; Fri, 3 Jan 1997 14:23:18 -0500 (EST)
Date: Fri, 3 Jan 1997 14:23:18 -0500 (EST)
From: Dave Mason <dmason@plg.uwaterloo.ca>
Message-Id: <199701031923.OAA08967@plg.uwaterloo.ca>
To: xemacs-beta@xemacs.org
Subject: XEmacs and FSF Emacs incompatibility
X-Face: %Q_F^9R-:'3MM7eZ6@E.x@f\*bgatzGv-8d%I~L[p^.F)3QF{kq\UTsu|e#?)3FPwJNvPPB
 !s*He|-*M^p*~bh"Nywm5NLL\\Rl3r(hWHY*F:$/RdKV*bS";n&#\Ov@*=]mu\}6tP<lkW*7FT|:Dm
 9ejO^{)GHJdPQaa"C\<Ak`K27?328'V(u*|jAEZR9-z!o\^j:Cb&*tx_9\KbXD*2

I just started trying to use a new mode (caml-mode).  It does an awful
hack (which it documents as such) to change the syntax-entry for _
before doing a looking-at.

XEmacs (19.14 -- someday I'm *not* going to be swamped, honest) does a
string-match in modify-syntax-entry which (I presume, or this code
would never have worked) FSF Emacs doesn't.  This makes for an ugly
incompatibility.  (Of course fixing it means putting a match-data and
store-match-data in modify-syntax-entry, which may well be worse than
the disease!)

My thought on seeing this was that having two syntax-tables and using
set-syntax-table to switch was probably a lot faster, and more
portable.  Am I wrong?  Does set-syntax-table change a lot of state?

../Dave

P.S. In order to get it to work, I had to change the code:

(defun caml-looking-at-word (w)
  (let ((old-syntax (char-syntax ?_))
	(p))
    (unwind-protect
	(progn
	  (modify-syntax-entry ?_ "w" caml-mode-syntax-table)
	  (setq p (looking-at w))
	  (setq match (match-data)))
      (modify-syntax-entry ?_ (char-to-string old-syntax)
			   caml-mode-syntax-table))
    p))

---to---

(defun caml-looking-at-word (w)
  (let ((old-syntax (char-syntax ?_))
	(p)
	(match (match-data)))
    (unwind-protect
	(progn
	  (modify-syntax-entry ?_ "w" caml-mode-syntax-table)
	  (setq p (looking-at w))
	  (setq match (match-data)))
      (modify-syntax-entry ?_ (char-to-string old-syntax)
			   caml-mode-syntax-table))
    (store-match-data match)
    p))

