From 0c096f945921593ce0771005068832948e629029 Mon Sep 17 00:00:00 2001 From: monnier <> Date: Wed, 31 Oct 2007 16:28:52 +0000 Subject: [PATCH] --- ChangeLog | 10 ++++++++++ sml-mode.el | 7 ++++++- sml-proc.el | 20 +++++++++++++++++--- totoe | 0 totof | 0 5 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 totoe create mode 100644 totof diff --git a/ChangeLog b/ChangeLog index c836bc40d..e50598885 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-10-31 Stefan Monnier + + * 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 * sml-util.el (defmap, defsyntax): Avoid defconst. diff --git a/sml-mode.el b/sml-mode.el index 43a642bc3..35abcea34 100644 --- a/sml-mode.el +++ b/sml-mode.el @@ -864,6 +864,11 @@ signature, structure, and functor by default.") (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 @@ -1011,7 +1016,7 @@ See also `edit-kbd-macro' which is bound to \\[edit-kbd-macro]." (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 diff --git a/sml-proc.el b/sml-proc.el index f6c55fce5..a57319730 100644 --- a/sml-proc.el +++ b/sml-proc.el @@ -308,6 +308,17 @@ If prefix argument ECHO is set, then it only reports on the current state." (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 @@ -386,6 +397,8 @@ TAB file name completion, as in shell-mode, etc.." ;; 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) @@ -664,9 +677,10 @@ Prefix arg AND-GO also means to `switch-to-sml' afterwards." ;; 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))) diff --git a/totoe b/totoe new file mode 100644 index 000000000..e69de29bb diff --git a/totof b/totof new file mode 100644 index 000000000..e69de29bb -- 2.39.2