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

SCM Repository

[smlnj] Annotation of /sml/trunk/sml-mode/sml-poly-ml.el
ViewVC logotype

Annotation of /sml/trunk/sml-mode/sml-poly-ml.el

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (view) (download)

1 : monnier 32 ;;; sml-poly-ml.el: Modifies inferior-sml-mode defaults for Poly/ML.
2 :    
3 :     ;; Copyright (C) 1994,1997 Matthew J. Morley
4 :    
5 :     ;; $Revision: 3.9 $
6 :     ;; $Date: 1997/06/23 09:21:25 $
7 :    
8 :     ;; This file is not part of GNU Emacs, but it is distributed under the
9 :     ;; same conditions.
10 :    
11 :     ;; ====================================================================
12 :    
13 :     ;; This program is free software; you can redistribute it and/or
14 :     ;; modify it under the terms of the GNU General Public License as
15 :     ;; published by the Free Software Foundation; either version 2, or (at
16 :     ;; your option) any later version.
17 :    
18 :     ;; This program is distributed in the hope that it will be useful, but
19 :     ;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 :     ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 :     ;; General Public License for more details.
22 :    
23 :     ;; You should have received a copy of the GNU General Public License
24 :     ;; along with GNU Emacs; see the file COPYING. If not, write to the
25 :     ;; Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26 :    
27 :     ;; ====================================================================
28 :    
29 :     ;;; DESCRIPTION
30 :    
31 :     ;; To use this library just put
32 :    
33 :     ;;(autoload 'sml-poly-ml "sml-poly-ml" "Set up and run Poly/ML." t)
34 :    
35 :     ;; in your .emacs file. If you only ever use Poly/ML then you might as
36 :     ;; well put something like
37 :    
38 :     ;;(setq sml-mode-hook
39 :     ;; '(lambda() "SML mode defaults to Poly/ML"
40 :     ;; (define-key sml-mode-map "\C-cp" 'sml-poly-ml)))
41 :    
42 :     ;; for your sml-load-hook. The command prompts for the program name
43 :     ;; and the database to use, if any.
44 :    
45 :     ;; If you need to reset the default value of sml-program-name, or any
46 :     ;; of the other compiler variables, put something like
47 :    
48 :     ;;(eval-after-load "sml-poly-ml" '(setq sml-program-name "whatever"))
49 :    
50 :     ;; in your .emacs -- or you can use the inferior-sml-{load,mode}-hooks
51 :     ;; to achieve the same ends.
52 :    
53 :     ;;; CODE
54 :    
55 :     (require 'sml-proc)
56 :    
57 :     (defconst sml-poly-ml-error-regexp
58 :     "^\\(Error\\|Warning:\\) in '\\(.*\\)', line \\([0-9]+\\)"
59 :     "Default regexp matching Poly/ML error messages.")
60 :    
61 :     ;; The reg-expression used when looking for errors. Poly/ML errors:
62 :    
63 :     ;; Warning: in 'puzz.sml', line 28
64 :     ;; Matches are not exhaustive.
65 :    
66 :     ;; Error
67 :     ;; Value or constructor (tl) has not been declared
68 :     ;; Found near tl(tl(tl(tl(N))))
69 :    
70 :     ;; (when input is from std_in -- i.e. entered directly at the prompt).
71 :    
72 :     (defun sml-poly-ml-error-parser (pt)
73 :     "This function parses a Poly/ML error message into a 3 element list.
74 :     (file start-line start-col) required by `sml-next-error'."
75 :     (save-excursion
76 :     (goto-char pt)
77 :     (if (not (looking-at sml-poly-ml-error-regexp))
78 :     ;; the user loses big time.
79 :     (list nil nil nil)
80 :     (list (match-string 2) ; the file
81 :     (string-to-int (match-string 3)) ; the start line
82 :     1)))) ; the start col
83 :    
84 :     ;;;###autoload
85 :     (defun sml-poly-ml (pfx)
86 :     "Set up and run Poly/ML.
87 :     Prefix argument means accept the defaults below.
88 :    
89 :     Note: defaults set here will be clobbered if you setq them in the
90 :     inferior-sml-mode-hook.
91 :    
92 :     sml-program-name <option> \(default \"poly\"\)
93 :     sml-default-arg <option dbase> \(default \"\"\)
94 :     sml-use-command \"PolyML.use \\\"%s\\\"\"
95 :     sml-cd-command \"PolyML.cd \\\"%s\\\"\"
96 :     sml-prompt-regexp \"^[>#] *\"
97 :     sml-error-regexp sml-poly-ml-error-regexp
98 :     sml-error-parser 'sml-poly-ml-error-parser"
99 :     (interactive "P")
100 :     (let ((cmd (if pfx "poly"
101 :     (read-string "Command name: " sml-program-name)))
102 :     (arg (if pfx ""
103 :     (read-file-name "Poly database? (default none): " "" ""))))
104 :     ;; sml-mode global variables
105 :     (setq sml-program-name cmd)
106 :     (setq sml-default-arg (if (equal arg "") "" (expand-file-name arg)))
107 :     ;; buffer-local (compiler-local) variables
108 :     (setq-default sml-use-command "PolyML.use \"%s\""
109 :     sml-cd-command "PolyML.cd \"%s\""
110 :     sml-prompt-regexp "^[>#] *"
111 :     sml-error-regexp sml-poly-ml-error-regexp
112 :     sml-error-parser 'sml-poly-ml-error-parser)
113 :     (sml-run cmd sml-default-arg)))
114 :    
115 :     ;;; Do the default setup on loading this file.
116 :    
117 :     ;; setqing these two may override user's hooked defaults. users
118 :     ;; therefore need load this file before setting sml-program-name or
119 :     ;; sml-default-arg in their inferior-sml-load-hook. sorry.
120 :    
121 :     (setq sml-program-name "poly"
122 :     sml-default-arg "")
123 :    
124 :     ;; same sort of problem here too: users should to setq-default these
125 :     ;; after this file is loaded, on inferior-sml-load-hook. as these are
126 :     ;; buffer-local, users can instead set them on inferior-sml-mode-hook.
127 :    
128 :     (setq-default sml-use-command "PolyML.use \"%s\""
129 :     sml-cd-command "PolyML.cd \"%s\""
130 :     sml-prompt-regexp "^[>#] *"
131 :     sml-error-regexp sml-poly-ml-error-regexp
132 :     sml-error-parser 'sml-poly-ml-error-parser)
133 :    
134 :     ;;; sml-poly-ml.el ended just there

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