+2007-10-31 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * sml-mode.el (sml-def-skeleton): If possible, only expand for
+ lower-case abbrevs and not inside strings or comments.
+ (sml-mlton-typecheck): Typo.
+
+ * sml-proc.el (sml-proc-comint-input-filter-function): New function.
+ (inferior-sml-mode): Use it.
+ (sml-update-cursor): Don't forget errors here any more.
+
2007-10-31 Stefan Monnier <monnier@iro.umontreal.ca>
* sml-util.el (defmap, defsyntax): Avoid defconst.
(define-abbrev sml-mode-abbrev-table ,name "" ',fsym nil 'system)
(wrong-number-of-arguments
(define-abbrev sml-mode-abbrev-table ,name "" ',fsym)))
+ (when (fboundp 'abbrev-put)
+ (let ((abbrev (abbrev-symbol ,name sml-mode-abbrev-table)))
+ (abbrev-put abbrev :case-fixed t)
+ (abbrev-put abbrev :enable-function
+ (lambda () (not (nth 8 (syntax-ppss)))))))
(define-skeleton ,fsym
,(format "SML-mode skeleton for `%s..' expressions" name)
,interactor
(read-file-name "Main file: "))))
(save-some-buffers)
(require 'compile)
- (dolist ((x sml-mlton-error-regexp-alist))
+ (dolist (x sml-mlton-error-regexp-alist)
(add-to-list 'compilation-error-regexp-alist x))
(with-current-buffer (find-file-noselect mainfile)
(compile (concat sml-mlton-command
(progn (call-interactively 'run-sml)
(get-buffer-process (current-buffer)))))
+(defun sml-proc-comint-input-filter-function (str)
+ ;; `compile.el' in Emacs-22 fails to notice that file location info from
+ ;; errors should be recomputed afresh (without using stale info from
+ ;; earlier compilations). We used to cause a refresh in sml-send-string,
+ ;; but this doesn't catch the case when the user types commands directly
+ ;; at the prompt.
+ (compilation-forget-errors) ;Has to run before compilation-fake-loc.
+ (if (and (fboundp 'compilation-fake-loc) sml-temp-file)
+ (compilation-fake-loc (cdr sml-temp-file) (car sml-temp-file)))
+ str)
+
(defun inferior-sml-next-error-hook ()
;; Try to recognize SML/NJ type error message and to highlight finely the
;; difference between the two types (in case they're large, it's not
;; Make TAB add a " rather than a space at the end of a file name.
(set (make-local-variable 'comint-completion-addsuffix) '(?/ . ?\"))
+ (add-hook 'comint-input-filter-functions
+ 'sml-proc-comint-input-filter-function nil t)
(set (make-local-variable 'font-lock-defaults)
inferior-sml-font-lock-defaults)
;; Update buffer local variable.
(set-marker sml-error-cursor (1- (process-mark (sml-proc))))
(setq sml-endof-error-alist nil)
- (compilation-forget-errors)
- (if (and (fboundp 'compilation-fake-loc) sml-temp-file)
- (compilation-fake-loc (cdr sml-temp-file) (car sml-temp-file)))
+ ;; This is now done in comint-input-filter-functions.
+ ;; (compilation-forget-errors) ;Has to run before compilation-fake-loc.
+ ;; (if (and (fboundp 'compilation-fake-loc) sml-temp-file)
+ ;; (compilation-fake-loc (cdr sml-temp-file) (car sml-temp-file)))
(if (markerp compilation-parsing-end)
(set-marker compilation-parsing-end sml-error-cursor)
(setq compilation-parsing-end sml-error-cursor)))