goo-mode for xemacs

Jonathan Bachrach <[email protected]> 20 Sep 2002 10:25:32 -0400
Newsgroups gmane.comp.lang.goo.general
Message-ID <[email protected]>
here's a message from a non-member:

Date: Fri, 20 Sep 2002 16:02:10 +0200
From: Alexander S A Kjeldaas <[email protected]>
To: [email protected]
Subject: goo-mode for xemacs
Message-ID: <[email protected]>
Content-Type: multipart/mixed; boundary=nFreZHaLTZJo0R7j


--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=us-ascii

I saw someone requested having goo-mode running under xemacs on irc.
I use the following patch (relative to 0.143) to get goo-mode with
font-locking working under xemacs.

astor

--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=out

--- /home/astor.new/ledig/goo-0_143-any-dev/emacs/goo.el	2002-06-19 06:17:15.000000000 +0200
+++ goo.el	2002-09-02 17:54:59.000000000 +0200
@@ -18,8 +18,23 @@
       ;; let's just use Lisp's syntax for now...
       (setq goo-mode-syntax-table table)
       (modify-syntax-entry ?| "_   " table)
-      ;; (modify-syntax-entry ?- "w   " goo-mode-syntax-table)
-      ))
+      (modify-syntax-entry ?- "w   " table)
+      (modify-syntax-entry ?< "w   " table)
+      (modify-syntax-entry ?> "w   " table)
+      (modify-syntax-entry ?+ "w   " table)
+      (modify-syntax-entry ?* "w   " table)
+      (modify-syntax-entry ?/ "w   " table)
+      (modify-syntax-entry ?. "w   " table)
+      (modify-syntax-entry ?= "w   " table)
+      (modify-syntax-entry ?! "w   " table)
+      (modify-syntax-entry ?? "w   " table)
+      (modify-syntax-entry ?$ "w   " table)
+      (modify-syntax-entry ?% "w   " table)
+      (modify-syntax-entry ?_ "w   " table)
+      (modify-syntax-entry ?& "w   " table)
+      (modify-syntax-entry ?~ "w   " table)
+      (modify-syntax-entry ?^ "w   " table)
+      (modify-syntax-entry ?: "w   " table)))
 
 (defvar goo-mode-abbrev-table nil "")
 (define-abbrev-table 'goo-mode-abbrev-table ())
@@ -30,11 +45,11 @@
     ("Variables"
      "^\\s-*(dv\\s-+\\(\\sw+\\)" 1)
     ("Functions"
-     "^\\s-*(df\\s-+\\(\\sw+\\)" 1)
+     "^\\s-*(df\\s-+\\(\\sw+\\(\\s-+(.*)\\)?\\)" 1)
     ("Methods"
-     "^\\s-*(dm\\s-+\\(\\sw+\\)" 1)
+     "^\\s-*(dm\\s-+\\(\\sw+\\(\\s-+(.*)\\)?\\)" 1)
     ("Generics"
-     "^\\s-*(dg\\s-+\\(\\sw+\\)" 1)
+     "^\\s-*(dg\\s-+\\(\\sw+\\(\\s-+(.*)\\)?\\)" 1)
     ("Syntax"
      "^\\s-*(ds\\s-+\\(\\sw+\\)" 1))
   "Imenu generic expression for Goo mode.  See `imenu-generic-expression'.")
@@ -60,7 +75,7 @@
 	   goo-font-lock-keywords-2)
           nil				; keywords-only: nil-> fontify strings * comments too
 	  t				; case-fold : t -> ignore case of keywords
-	  (("+-*/.<>=!?$%_&~^:" . "w"))	; syntax-alist : ???
+	  nil
 	  beginning-of-defun
           (font-lock-mark-block-function . mark-defun))))
 
@@ -136,10 +151,16 @@
 (defconst goo-font-lock-keywords-1
   (eval-when-compile
     (list
-     '("(\\(dv\\|df\\|def\\sw*\\|dm\\|dg\\|dp\\|dc\\|dl\\)\\s-+\\(\\sw+\\)"
+     '("(\\(df\\|def\\sw*\\|dm\\|dg\\|dp\\|dc\\|dl\\)\\s-+\\(\\sw+\\)"
        (1 font-lock-keyword-face)
        (2 font-lock-function-name-face nil t))
-     '("^\\s-*(\\(dss?\\)" . 1)))
+     '("^\\s-*(\\(dss?\\)" . 1)
+     '("(\\(dv\\) \\(\\sw+\\)"
+       (1 font-lock-keyword-face)
+       (2 font-lock-variable-name-face))
+     '("(\\(use\\) \\(\\sw+\\)"
+       (1 font-lock-keyword-face)
+       (2 font-lock-reference-face))))
   "Subdued expressions to highlight in Goo modes.")
 
 (defconst goo-font-lock-keywords-2
@@ -148,15 +169,21 @@
      (list
       (cons
        (concat
-	"(" (regexp-opt
+	"(\\(" (regexp-opt
 	     '("if" "seq" "set" "fun" "loc" "lab"
 	       "fin" "try" "sig" "isa" "slot" "ct" "expand"
 	       "quote" "rep" "mif" "and" "or" "unless" "when"
 	       "incf" "decf" "inc" "dec" "case" "select" "for" "let"
 	       "packing" "pack" "use" "export" "need-implementation"
-	       "ct-also" "pushf" "popf" "dlet") t)
-	"\\>") 1)
+	       "ct-also" "pushf" "popf" "dlet"))
+	"\\|\\(with\\|for\\)-\\sw+\\)\\>") 1)
       '("\\(#t\\|#f\\|=>\\)" . font-lock-keyword-face)
+      '("\\<\\(\\sw+\\)|\\(<\\sw+>\\>\\)" 
+	(1 font-lock-variable-name-face)
+	(2 font-lock-type-face))
+      '("\\<\\(\\sw+\\)|\\((t[<>=].*?)\\)"
+	(1 font-lock-variable-name-face)
+	(2 font-lock-type-face))
       ;; David Fox <[email protected]> for SOS/STklos class specifiers.
       '("\\<<\\sw+>\\>" . font-lock-type-face))))
   "Gaudy expressions to highlight in Goo modes.")

--nFreZHaLTZJo0R7j--