]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/sml-mode/sml-mode.el
Merge remote-tracking branch 'ggtags/master'
[gnu-emacs-elpa] / packages / sml-mode / sml-mode.el
index 02b35e2dcabde8fb6469626b4dbb841eb6ed423e..1c06f1600f373a3f28b883837739963eb3cedb3b 100644 (file)
@@ -1,9 +1,9 @@
 ;;; sml-mode.el --- Major mode for editing (Standard) ML  -*- lexical-binding: t; coding: utf-8 -*-
 
-;; Copyright (C) 1989,1999,2000,2004,2007,2010-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1989,1999,2000,2004,2007,2010-2013  Free Software Foundation, Inc.
 
 ;; Maintainer: (Stefan Monnier) <monnier@iro.umontreal.ca>
-;; Version: 6.1
+;; Version: 6.4
 ;; Keywords: SML
 ;; Author:     Lars Bo Nielsen
 ;;             Olin Shivers
@@ -164,6 +164,8 @@ notion of \"the end of an outline\".")
     (define-key map "\M-|" 'sml-electric-pipe)
     (define-key map "\M-\ " 'sml-electric-space)
     (define-key map [backtab] 'sml-back-to-outer-indent)
+    ;; The standard binding is C-c C-z, but we add this one for compatibility.
+    (define-key map "\C-c\C-s" 'sml-prog-proc-switch-to)
     map)
   "The keymap used in `sml-mode'.")
 
@@ -492,6 +494,7 @@ Regexp match data 0 points to the chars."
              (basic sml-indent-level)
              (args  sml-indent-args)))
     (:list-intro (member token '("fn")))
+    (:close-all t)
     (:after
      (cond
       ((equal token "struct") 0)
@@ -654,7 +657,7 @@ Assumes point is right before the | symbol."
 ;;;; Imenu support
 ;;;;
 
-(defvar sml-imenu-regexp
+(defconst sml-imenu-regexp
   (concat "^[ \t]*\\(let[ \t]+\\)?"
          (regexp-opt (append sml-module-head-syms
                              '("and" "fun" "datatype" "abstype" "type")) t)
@@ -676,9 +679,9 @@ Assumes point is right before the | symbol."
              (name (sml-smie-forward-token)))
          ;; Eliminate trivial renamings.
          (when (or (not (member kind '("structure" "signature")))
-                   (progn (search-forward "=")
-                          (forward-comment (point-max))
-                          (looking-at "sig\\|struct")))
+                   (when (search-forward "=" nil t)
+                      (forward-comment (point-max))
+                      (looking-at "sig\\|struct")))
            (push (cons (concat (make-string (/ column 2) ?\ ) name) location)
                  alist)))))
     alist))
@@ -755,6 +758,7 @@ Assumes point is right before the | symbol."
 
 (defun sml-prog-proc-switch-to ()
   "Switch to the buffer running the read-eval-print process."
+  (interactive)
   (pop-to-buffer (sml-prog-proc-buffer)))
 
 (defun sml-prog-proc-send-string (proc str)
@@ -1198,7 +1202,7 @@ TAB file name completion, as in shell-mode, etc.."
   (add-hook 'next-error-hook 'inferior-sml-next-error-hook)
 
   ;; Make TAB add a " rather than a space at the end of a file name.
-  (set (make-local-variable 'comint-completion-addsuffix) '(?/ . ?\"))
+  (set (make-local-variable 'comint-completion-addsuffix) '("/" . "\""))
 
   (set (make-local-variable 'font-lock-defaults)
        inferior-sml-font-lock-defaults)
@@ -1224,7 +1228,6 @@ TAB file name completion, as in shell-mode, etc.."
 This mode runs `sml-mode-hook' just before exiting.
 See also (info \"(sml-mode)Top\").
 \\{sml-mode-map}"
-  (set (make-local-variable 'sml-prog-proc-descriptor) sml-pp-functions)
   (set (make-local-variable 'font-lock-defaults) sml-font-lock-defaults)
   (set (make-local-variable 'outline-regexp) sml-outline-regexp)
   (set (make-local-variable 'imenu-create-index-function)
@@ -1251,6 +1254,7 @@ See also (info \"(sml-mode)Top\").
   (sml-mode-variables))
 
 (defun sml-mode-variables ()
+  (set (make-local-variable 'sml-prog-proc-descriptor) sml-pp-functions)
   (set-syntax-table sml-mode-syntax-table)
   (setq local-abbrev-table sml-mode-abbrev-table)
   ;; Setup indentation and sexp-navigation.