Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml-mode/trunk/sml-util.el
ViewVC logotype

Diff of /sml-mode/trunk/sml-util.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2816, Tue Oct 30 18:39:53 2007 UTC revision 2817, Wed Oct 31 04:07:04 2007 UTC
# Line 1  Line 1 
1  ;;; sml-util.el --- Utility functions for sml-mode  ;;; sml-util.el --- Utility functions for sml-mode
2    
3  ;; Copyright (C) 1999-2000  Stefan Monnier <monnier@cs.yale.edu>  ;; Copyright (C) 1999-2000, 2007  Stefan Monnier <monnier@cs.yale.edu>
4  ;;  ;;
5  ;; This program is free software; you can redistribute it and/or modify  ;; This program is free software; you can redistribute it and/or modify
6  ;; it under the terms of the GNU General Public License as published by  ;; it under the terms of the GNU General Public License as published by
7  ;; the Free Software Foundation; either version 2 of the License, or  ;; the Free Software Foundation; either version 3 of the License, or
8  ;; (at your option) any later version.  ;; (at your option) any later version.
9  ;;  ;;
10  ;; This program is distributed in the hope that it will be useful,  ;; This program is distributed in the hope that it will be useful,
# Line 24  Line 24 
24  (require 'cl)                           ;for `reduce'  (require 'cl)                           ;for `reduce'
25  (require 'sml-compat)  (require 'sml-compat)
26    
 ;;  
   
 (defun flatten (ls &optional acc)  
   (if (null ls) acc  
     (let ((rest (flatten (cdr ls) acc))  
           (head (car ls)))  
       (if (listp head)  
           (flatten head rest)  
         (cons head rest)))))  
   
27  (defun sml-preproc-alist (al)  (defun sml-preproc-alist (al)
28    "Expand an alist AL where keys can be lists of keys into a normal one."    "Expand an alist AL where keys can be lists of keys into a normal one."
29    (reduce (lambda (x al)    (reduce (lambda (x al)
# Line 83  Line 73 
73      m))      m))
74    
75  (defmacro defmap (m bs doc &rest args)  (defmacro defmap (m bs doc &rest args)
76    `(defconst ,m    `(defvar ,m
77       (custom-create-map (if (boundp ',m) ,m) ,bs ,(cons 'list args))       (custom-create-map (if (boundp ',m) ,m) ,bs ,(cons 'list args))
78       ,doc))       ,doc))
79    
# Line 100  Line 90 
90      st))      st))
91    
92  (defmacro defsyntax (st css doc &rest args)  (defmacro defsyntax (st css doc &rest args)
93    `(defconst ,st (custom-create-syntax ,css ,(cons 'list args)) ,doc))    `(defvar ,st (custom-create-syntax ,css ,(cons 'list args)) ,doc))
94    
95  ;;;;  ;;;;
96  ;;;; Compatibility info  ;;;; Compatibility info

Legend:
Removed from v.2816  
changed lines
  Added in v.2817

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0