#! /bin/sh /usr/share/dpatch/dpatch-run ## 20_alice_sml.dpatch by Yang Shouxun ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: add support to Alice SML dialect ## DP: the patch is not written by me, but made based on ## DP: http://www.ps.uni-sb.de/alice/download/sml-mode-4.0+alice.tgz ## DP: send to upstream if it works everywhere @DPATCH@ diff -aruN sml-mode-4.0.orig/INSTALL-WINDOWS sml-mode-4.0/INSTALL-WINDOWS --- sml-mode-4.0.orig/INSTALL-WINDOWS 1970-01-01 08:00:00.000000000 +0800 +++ sml-mode-4.0/INSTALL-WINDOWS 2005-02-17 02:19:56.000000000 +0800 @@ -0,0 +1,20 @@ +On Windows, if you have Cygwin, proceed as described in INSTALL. Otherwise, +you have to install the SML mode by hand. + +1) Go to your Emacs installation directory (e.g. C:\Program Files\Emacs). + +2) In the site-lisp subdirectory, create a new directory named sml-mode. + +3) Copy all *.el files to it. + +4) In the site-lisp subdirectory, edit the file site-start.el and add the + following two lines: + + (add-to-list 'load-path "C:/Program Files/Emacs/site-lisp/sml-mode") + (load "sml-mode/sml-mode-startup") + + (Adapt the path to your installation directory.) + +Optionally, to add the sml-mode documentation to the Emacs info system: + +5) Copy sml-mode.info to the info subdirectory. diff -aruN sml-mode-4.0.orig/README-ALICE sml-mode-4.0/README-ALICE --- sml-mode-4.0.orig/README-ALICE 1970-01-01 08:00:00.000000000 +0800 +++ sml-mode-4.0/README-ALICE 2005-02-17 02:19:56.000000000 +0800 @@ -0,0 +1,35 @@ +Patched for Alice ML: + +sml-mode.el: + +- extend sml-keywords-regexp (all keywords) + "any" "assert" "constructor" "exttype" "fct" "from" "import" + "non" "lazy" "pack" "spawn" "unpack" "withfun" "withval") +- modify auto-mode-alist (aml, asig) + (add-to-list 'auto-mode-alist '("\\.\\(sml\\|sig\\|aml\\|asig\\)\\'" . sml-mode)) + +sml-defs.el: + +- extend sml-non-nested-of-starter-re (contructor) + (sml-syms-re "datatype" "abstype" "exception" "constructor") +- extend sml-starters-syms (contructor, exttype, import, withval, withfun) + "withtype" "with" + "constructor" "exttype" "withval" "withfun")) + +sml-proc.el: + +- extend sml-error-regexp-alist + ;; Alice ML + ("^\\(\\(.+\\):\\)?\\([0-9]+\\)\\.\\([0-9]+\\)-\\([0-9]+\\)\\.\\([0-9]+\\):" 2 3 4) +- patch sml-run to default to "alice" program name for .aml buffers: + (read-string "ML command: " + (let ((ext (file-name-extension (buffer-file-name (current-buffer))))) + (if (or (string= ext "aml") (string= ext "asig")) + "alice" + sml-program-name))) +- modify sml-send-region to write temp file in local directory: + (tmp (make-temp-file (buffer-file-name (current-buffer))))) + +sml-mode-startup.el: + +- rebuilt diff -aruN sml-mode-4.0.orig/sml-defs.el sml-mode-4.0/sml-defs.el --- sml-mode-4.0.orig/sml-defs.el 2003-12-10 11:30:06.000000000 +0800 +++ sml-mode-4.0/sml-defs.el 2005-02-17 02:19:56.000000000 +0800 @@ -230,15 +230,16 @@ "Regexp of compound symbols (pairs of symbols to be considered as one).") (defconst sml-non-nested-of-starter-re - (sml-syms-re "datatype" "abstype" "exception") + (sml-syms-re "datatype" "abstype" "exception" "constructor") "Symbols that can introduce an `of' that shouldn't behave like a paren.") (defconst sml-starters-syms (append sml-module-head-syms '("abstype" "datatype" "exception" "fun" - "local" "infix" "infixr" "sharing" "nonfix" + "local" "import" "infix" "infixr" "sharing" "nonfix" "open" "type" "val" "and" - "withtype" "with")) + "withtype" "with" + "constructor" "exttype" "withval" "withfun")) "The starters of new expressions.") (defconst sml-exptrail-syms diff -aruN sml-mode-4.0.orig/sml-mode.el sml-mode-4.0/sml-mode.el --- sml-mode-4.0.orig/sml-mode.el 2004-11-23 13:13:59.000000000 +0800 +++ sml-mode-4.0/sml-mode.el 2005-02-17 02:19:56.000000000 +0800 @@ -165,7 +165,9 @@ "infixr" "let" "local" "nonfix" "of" "op" "open" "orelse" "overload" "raise" "rec" "sharing" "sig" "signature" "struct" "structure" "then" "type" "val" "where" "while" - "with" "withtype" "o") + "with" "withtype" "o" + "any" "assert" "constructor" "exttype" "fct" "from" "import" + "non" "lazy" "pack" "spawn" "unpack" "withfun" "withval") "A regexp that matches any and all keywords of SML.") (defconst sml-tyvarseq-re @@ -389,7 +391,7 @@ ;;;###autoload (add-to-list 'load-path (file-name-directory load-file-name)) ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.s\\(ml\\|ig\\)\\'" . sml-mode)) +(add-to-list 'auto-mode-alist '("\\.\\(sml\\|sig\\|aml\\|asig\\)\\'" . sml-mode)) ;;;###autoload (define-derived-mode sml-mode fundamental-mode "SML" diff -aruN sml-mode-4.0.orig/sml-mode-startup.el sml-mode-4.0/sml-mode-startup.el --- sml-mode-4.0.orig/sml-mode-startup.el 2005-10-12 16:00:04.000000000 +0800 +++ sml-mode-4.0/sml-mode-startup.el 2005-02-17 02:19:56.000000000 +0800 @@ -1,10 +1,10 @@ ;;;### (autoloads (sml-yacc-mode sml-lex-mode sml-cm-mode sml-mode) -;;;;;; "sml-mode" "sml-mode.el" (17210 22449)) +;;;;;; "sml-mode" "sml-mode.el" (16904 55894)) ;;; Generated autoloads from sml-mode.el (add-to-list 'load-path (file-name-directory load-file-name)) -(add-to-list (quote auto-mode-alist) (quote ("\\.s\\(ml\\|ig\\)\\'" . sml-mode))) +(add-to-list (quote auto-mode-alist) (quote ("\\.\\(sml\\|sig\\|aml\\|asig\\)\\'" . sml-mode))) (autoload (quote sml-mode) "sml-mode" "\ \\Major mode for editing ML code. @@ -28,7 +28,7 @@ ;;;*** -;;;### (autoloads nil "sml-proc" "sml-proc.el" (16947 25211)) +;;;### (autoloads nil "sml-proc" "sml-proc.el" (16914 12724)) ;;; Generated autoloads from sml-proc.el (autoload (quote run-sml) "sml-proc" nil t) diff -aruN sml-mode-4.0.orig/sml-proc.el sml-mode-4.0/sml-proc.el --- sml-mode-4.0.orig/sml-proc.el 2004-11-15 11:51:19.000000000 +0800 +++ sml-mode-4.0/sml-proc.el 2005-02-17 02:19:56.000000000 +0800 @@ -211,6 +211,8 @@ ("^\\(Error\\|Warning:\\) in '\\(.+\\)', line \\([0-9]+\\)" 2 3) ;; Moscow ML ("^File \"\\([^\"]+\\)\", line \\([0-9]+\\)\\(-\\([0-9]+\\)\\)?, characters \\([0-9]+\\)-\\([0-9]+\\):" 1 2 5) + ;; Alice ML + ("^\\(\\(.+\\):\\)?\\([0-9]+\\)\\.\\([0-9]+\\)-\\([0-9]+\\)\\.\\([0-9]+\\):" 2 3 4) ;; SML/NJ: the file-pattern is anchored to avoid ;; pathological behavior with very long lines. ("^[-= ]*\\(.*[^\n)]\\)\\( (.*)\\)?:\\([0-9]+\\)\\.\\([0-9]+\\)\\(-\\([0-9]+\\)\\.\\([0-9]+\\)\\)? \\(Error\\|Warnin\\(g\\)\\): .*" 1 @@ -399,7 +401,11 @@ \(Type \\[describe-mode] in the process buffer for a list of commands.)" (interactive (list - (read-string "ML command: " sml-program-name) + (read-string "ML command: " + (let ((ext (file-name-extension (buffer-file-name (current-buffer))))) + (if (or (string= ext "aml") (string= ext "asig")) + "alice" + sml-program-name))) (if (or current-prefix-arg (> (length sml-default-arg) 0)) (read-string "Any args: " sml-default-arg) sml-default-arg) @@ -456,7 +462,7 @@ (message "The region is zero (ignored)") (let* ((buf (sml-proc-buffer)) (marker (copy-marker start)) - (tmp (make-temp-file "sml"))) + (tmp (make-temp-file (buffer-file-name (current-buffer))))) (write-region start end tmp nil 'silently) (with-current-buffer buf (when sml-temp-file