1 |
;;; sml-util.el |
;;; sml-util.el --- Utility functions for sml-mode |
2 |
|
|
3 |
(defconst rcsid-sml-util "@(#)$Name$:$Id$") |
;; Copyright (C) 1999-2000 Stefan Monnier <monnier@cs.yale.edu> |
|
|
|
|
;; Copyright (C) 1999-1999 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 |
16 |
;; along with this program; if not, write to the Free Software |
;; along with this program; if not, write to the Free Software |
17 |
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
18 |
|
|
19 |
(require 'cl) |
|
20 |
|
;;; Commentary: |
21 |
|
|
22 |
|
;;; Code: |
23 |
|
|
24 |
|
(require 'cl) ;for `reduce' |
25 |
(require 'sml-compat) |
(require 'sml-compat) |
26 |
|
|
27 |
;; |
;; |
28 |
|
|
|
(defmacro concatq (&rest ss) |
|
|
"Concatenate all the arguments and make the result a string. |
|
|
As opposed to `concat', `concatq' does not evaluate its arguments |
|
|
and is hence executed at macro-expansion-time." |
|
|
(apply 'concat ss)) |
|
|
|
|
29 |
(defun flatten (ls &optional acc) |
(defun flatten (ls &optional acc) |
30 |
(if (null ls) acc |
(if (null ls) acc |
31 |
(let ((rest (flatten (cdr ls) acc)) |
(let ((rest (flatten (cdr ls) acc)) |
35 |
(cons head rest))))) |
(cons head rest))))) |
36 |
|
|
37 |
(defun sml-preproc-alist (al) |
(defun sml-preproc-alist (al) |
38 |
"Expand an alist 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." |
39 |
(reduce (lambda (x al) |
(reduce (lambda (x al) |
40 |
(let ((k (car x)) |
(let ((k (car x)) |
41 |
(v (cdr x))) |
(v (cdr x))) |
112 |
(modify-syntax-entry ?\* ". 23n" st) st) |
(modify-syntax-entry ?\* ". 23n" st) st) |
113 |
(let ((st (make-syntax-table))) |
(let ((st (make-syntax-table))) |
114 |
(modify-syntax-entry ?\* ". 23" st) st)))) |
(modify-syntax-entry ?\* ". 23" st) st)))) |
115 |
"Whether this Emacs understands the `n' in syntax entries.") |
"Non-nil means this Emacs understands the `n' in syntax entries.") |
116 |
|
|
|
;; |
|
117 |
(provide 'sml-util) |
(provide 'sml-util) |
118 |
|
|
119 |
|
;;; sml-util.el ends here |