[MLton-commit] r5106
Vesa Karvonen
vesak at mlton.org
Thu Feb 1 08:44:00 PST 2007
Shortened module name for convenience (the module is soon supposed to
contain more code).
----------------------------------------------------------------------
U mlton/trunk/ide/emacs/def-use-mode.el
D mlton/trunk/ide/emacs/esml-def-use-mlton.el
A mlton/trunk/ide/emacs/esml-du-mlton.el
----------------------------------------------------------------------
Modified: mlton/trunk/ide/emacs/def-use-mode.el
===================================================================
--- mlton/trunk/ide/emacs/def-use-mode.el 2007-02-01 16:34:47 UTC (rev 5105)
+++ mlton/trunk/ide/emacs/def-use-mode.el 2007-02-01 16:43:55 UTC (rev 5106)
@@ -12,8 +12,8 @@
;; 0. Compile the latest MLton from SVN.
;; 1. Generate a def-use file using MLton with the (new)
;; -prefer-abs-paths true option.
-;; 2. Load all of the def-use-*.el files and `esml-def-use-mlton.el'.
-;; 3. M-x esml-def-use-mlton-parse <def-use-file>
+;; 2. Load all of the `def-use-*.el' files and `esml-du-mlton.el'.
+;; 3. M-x esml-du-mlton-parse <def-use-file>
;; (It may take some time for parsing to finish, but you can continue
;; editing at the same time.)
;; 4. M-x def-use-mode
Deleted: mlton/trunk/ide/emacs/esml-def-use-mlton.el
===================================================================
--- mlton/trunk/ide/emacs/esml-def-use-mlton.el 2007-02-01 16:34:47 UTC (rev 5105)
+++ mlton/trunk/ide/emacs/esml-def-use-mlton.el 2007-02-01 16:43:55 UTC (rev 5106)
@@ -1,83 +0,0 @@
-;; Copyright (C) 2007 Vesa Karvonen
-;;
-;; MLton is released under a BSD-style license.
-;; See the file MLton-LICENSE for details.
-
-(require 'def-use-mode)
-(require 'sml-mode)
-(require 'bg-job)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Parsing of def-use -files produced by MLton.
-
-(defun esml-def-use-read (taking skipping)
- (let ((start (point)))
- (skip-chars-forward taking)
- (let ((result (buffer-substring start (point))))
- (skip-chars-forward skipping)
- result)))
-
-(defconst esml-def-use-kinds
- `((,(def-use-intern "variable") . ,font-lock-variable-name-face)
- (,(def-use-intern "type") . ,font-lock-type-def-face)
- (,(def-use-intern "constructor") . ,font-lock-constant-face)
- (,(def-use-intern "structure") . ,font-lock-module-def-face)
- (,(def-use-intern "signature") . ,font-lock-interface-def-face)
- (,(def-use-intern "functor") . ,font-lock-module-def-face)
- (,(def-use-intern "exception") . ,font-lock-module-def-face)))
-
-(defun esml-def-use-mlton-parse (duf)
- "Parses a def-use -file. Because parsing may take a while, it is
-done as a background process. This allows you to continue working
-altough the editor may feel a bit sluggish."
- (interactive "fSpecify def-use -file: ")
- (setq duf (def-use-file-truename duf))
- (let ((buf (generate-new-buffer (concat "** " duf " **"))))
- (with-current-buffer buf
- (buffer-disable-undo buf)
- (insert-file duf)
- (goto-char 1)
- (setq buffer-read-only t))
- (message (concat "Parsing " duf " in the background..."))
- (bg-job-start
- (function
- (lambda (duf buf)
- (with-current-buffer buf
- (eobp))))
- (function
- (lambda (duf buf)
- (with-current-buffer buf
- (goto-char 1)
- (let* ((kind (def-use-intern (esml-def-use-read "^ " " ")))
- (name (def-use-intern (esml-def-use-read "^ " " ")))
- (src (def-use-file-truename
- (esml-def-use-read "^ " " ")))
- (line (string-to-int (esml-def-use-read "^." ".")))
- (col (- (string-to-int (esml-def-use-read "^\n" "\n")) 1))
- (pos (def-use-pos line col))
- (ref (def-use-ref src pos))
- (sym (def-use-sym kind name ref
- (cdr (assoc kind esml-def-use-kinds)))))
- (def-use-add-def duf sym)
- (while (< 0 (skip-chars-forward " "))
- (let* ((src (def-use-file-truename
- (esml-def-use-read "^ " " ")))
- (line (string-to-int (esml-def-use-read "^." ".")))
- (col (- (string-to-int (esml-def-use-read "^\n" "\n"))
- 1))
- (pos (def-use-pos line col))
- (ref (def-use-ref src pos)))
- (def-use-add-use ref sym))))
- (setq buffer-read-only nil)
- (delete-backward-char (- (point) 1))
- (setq buffer-read-only t))
- (list duf buf)))
- (function
- (lambda (duf buf)
- (kill-buffer buf)
- (message (concat "Finished parsing " duf "."))))
- duf buf)))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(provide 'esml-def-use-mlton)
Copied: mlton/trunk/ide/emacs/esml-du-mlton.el (from rev 5105, mlton/trunk/ide/emacs/esml-def-use-mlton.el)
===================================================================
--- mlton/trunk/ide/emacs/esml-def-use-mlton.el 2007-02-01 16:34:47 UTC (rev 5105)
+++ mlton/trunk/ide/emacs/esml-du-mlton.el 2007-02-01 16:43:55 UTC (rev 5106)
@@ -0,0 +1,83 @@
+;; Copyright (C) 2007 Vesa Karvonen
+;;
+;; MLton is released under a BSD-style license.
+;; See the file MLton-LICENSE for details.
+
+(require 'def-use-mode)
+(require 'sml-mode)
+(require 'bg-job)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Parsing of def-use -files produced by MLton.
+
+(defun esml-du-read (taking skipping)
+ (let ((start (point)))
+ (skip-chars-forward taking)
+ (let ((result (buffer-substring start (point))))
+ (skip-chars-forward skipping)
+ result)))
+
+(defconst esml-du-kinds
+ `((,(def-use-intern "variable") . ,font-lock-variable-name-face)
+ (,(def-use-intern "type") . ,font-lock-type-def-face)
+ (,(def-use-intern "constructor") . ,font-lock-constant-face)
+ (,(def-use-intern "structure") . ,font-lock-module-def-face)
+ (,(def-use-intern "signature") . ,font-lock-interface-def-face)
+ (,(def-use-intern "functor") . ,font-lock-module-def-face)
+ (,(def-use-intern "exception") . ,font-lock-module-def-face)))
+
+(defun esml-du-mlton-parse (duf)
+ "Parses a def-use -file. Because parsing may take a while, it is
+done as a background process. This allows you to continue working
+altough the editor may feel a bit sluggish."
+ (interactive "fSpecify def-use -file: ")
+ (setq duf (def-use-file-truename duf))
+ (let ((buf (generate-new-buffer (concat "** " duf " **"))))
+ (with-current-buffer buf
+ (buffer-disable-undo buf)
+ (insert-file duf)
+ (goto-char 1)
+ (setq buffer-read-only t))
+ (message (concat "Parsing " duf " in the background..."))
+ (bg-job-start
+ (function
+ (lambda (duf buf)
+ (with-current-buffer buf
+ (eobp))))
+ (function
+ (lambda (duf buf)
+ (with-current-buffer buf
+ (goto-char 1)
+ (let* ((kind (def-use-intern (esml-du-read "^ " " ")))
+ (name (def-use-intern (esml-du-read "^ " " ")))
+ (src (def-use-file-truename
+ (esml-du-read "^ " " ")))
+ (line (string-to-int (esml-du-read "^." ".")))
+ (col (- (string-to-int (esml-du-read "^\n" "\n")) 1))
+ (pos (def-use-pos line col))
+ (ref (def-use-ref src pos))
+ (sym (def-use-sym kind name ref
+ (cdr (assoc kind esml-du-kinds)))))
+ (def-use-add-def duf sym)
+ (while (< 0 (skip-chars-forward " "))
+ (let* ((src (def-use-file-truename
+ (esml-du-read "^ " " ")))
+ (line (string-to-int (esml-du-read "^." ".")))
+ (col (- (string-to-int (esml-du-read "^\n" "\n"))
+ 1))
+ (pos (def-use-pos line col))
+ (ref (def-use-ref src pos)))
+ (def-use-add-use ref sym))))
+ (setq buffer-read-only nil)
+ (delete-backward-char (- (point) 1))
+ (setq buffer-read-only t))
+ (list duf buf)))
+ (function
+ (lambda (duf buf)
+ (kill-buffer buf)
+ (message (concat "Finished parsing " duf "."))))
+ duf buf)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(provide 'esml-du-mlton)
More information about the MLton-commit
mailing list