]> code.delx.au - gnu-emacs-elpa/commitdiff
Get rid of ancient compatibility and small utility file.
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 11 Apr 2012 15:40:56 +0000 (11:40 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 11 Apr 2012 15:40:56 +0000 (11:40 -0400)
* sml-proc.el (inferior-sml-mode-map): Don't use defmap.
* sml-move.el (sml-internal-syntax-table): Don't use defsyntax.
* sml-mode.el (sml-syntax-prop-table): Don't use defsyntax.
(sml-electric-space): `last-command-char' -> `last-command-event'.
(sml-defuse-jump-to-def): Don't use goto-line from Elisp.
* sml-defs.el (sml-mode-map): Don't use defmap.
(sml-mode-syntax-table): Don't use defsyntax.
(sml-preproc-alist, sml-builtin-nested-comments-flag):
Move from sml-util.el.
* sml-compat.el, sml-utils.el: Remove.
* makefile.pkg (ELFILES): Update.

ChangeLog
makefile.pkg
sml-compat.el [deleted file]
sml-defs.el
sml-mode.el
sml-mode.spec [changed mode: 0755->0644]
sml-move.el
sml-proc.el
sml-util.el [deleted file]

index c774910fdc745e0a3886463716344c57b53ea008..ce1ca45bb289f3382e3695ad1682bcc1e00224d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,24 @@
+2012-04-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Get rid of ancient compatibility and small utility file.
+       * sml-proc.el (inferior-sml-mode-map): Don't use defmap.
+       * sml-move.el (sml-internal-syntax-table): Don't use defsyntax.
+       * sml-mode.el (sml-syntax-prop-table): Don't use defsyntax.
+       (sml-electric-space): `last-command-char' -> `last-command-event'.
+       (sml-defuse-jump-to-def): Don't use goto-line from Elisp.
+       * sml-defs.el (sml-mode-map): Don't use defmap.
+       (sml-mode-syntax-table): Don't use defsyntax.
+       (sml-preproc-alist, sml-builtin-nested-comments-flag):
+       Move from sml-util.el.
+       * sml-compat.el, sml-utils.el: Remove.
+       * makefile.pkg (ELFILES): Update.
+
 2012-04-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        Add SMIE support.
        * .bzrignore: New file.
        * makefile.pkg (test): Use sml-mode-startup.
+
        * sml-mode.el (sml-use-smie): New config var.
        (sml-smie-grammar, sml-indent-separator-outdent): New vars.
        (sml-smie-rules, sml-smie-definitional-equal-p)
index 06dcecbca96b1f242a4c658d2c51c80228d9b071..7df75511eac8a4df7d4de0bbcb117f06c5740087 100644 (file)
@@ -1,6 +1,5 @@
 PACKAGE = sml-mode
-ELFILES        = sml-compat.el sml-util.el sml-defs.el sml-move.el sml-mode.el \
-       sml-proc.el
+ELFILES        = sml-defs.el sml-move.el sml-mode.el sml-proc.el
 
 default: elcfiles
 
diff --git a/sml-compat.el b/sml-compat.el
deleted file mode 100644 (file)
index c7453fe..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-;;; sml-compat.el --- Compatibility functions for Emacs variants for sml-mode
-
-;; Copyright (C) 1999, 2000, 2004, 2007  Stefan Monnier <monnier@gnu.org>
-;;
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3 of the License, or
-;; (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program; if not, write to the Free Software
-;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-;;; Commentary:
-
-;;; Code:
-
-(require 'cl)
-
-(unless (fboundp 'set-keymap-parents)
-  (defun set-keymap-parents (m parents)
-    (if (keymapp parents) (setq parents (list parents)))
-    (set-keymap-parent
-     m
-     (if (cdr parents)
-        (reduce (lambda (m1 m2)
-                  (let ((m (copy-keymap m1)))
-                    (set-keymap-parent m m2) m))
-                parents
-                :from-end t)
-       (car parents)))))
-
-;; for XEmacs
-(when (fboundp 'temp-directory)
-  (defvar temporary-file-directory (temp-directory)))
-
-(unless (fboundp 'make-temp-file)
-  ;; Copied from Emacs-21's subr.el
-  (defun make-temp-file (prefix &optional dir-flag)
-  "Create a temporary file.
-The returned file name (created by appending some random characters at the end
-of PREFIX, and expanding against `temporary-file-directory' if necessary,
-is guaranteed to point to a newly created empty file.
-You can then use `write-region' to write new data into the file.
-
-If DIR-FLAG is non-nil, create a new empty directory instead of a file."
-  (let (file)
-    (while (condition-case ()
-              (progn
-                (setq file
-                      (make-temp-name
-                       (expand-file-name prefix temporary-file-directory)))
-                (if dir-flag
-                    (make-directory file)
-                  (write-region "" nil file nil 'silent))
-                nil)
-           (file-already-exists t))
-      ;; the file was somehow created by someone else between
-      ;; `make-temp-name' and `write-region', let's try again.
-      nil)
-    file)))
-
-
-
-(unless (fboundp 'regexp-opt)
-  (defun regexp-opt (strings &optional paren)
-    (let ((open (if paren "\\(" "")) (close (if paren "\\)" "")))
-      (concat open (mapconcat 'regexp-quote strings "\\|") close))))
-
-
-;;;; 
-;;;; Custom
-;;;; 
-
-;; doesn't exist in Emacs < 20.1
-(unless (fboundp 'set-face-bold-p)
-  (defun set-face-bold-p (face v &optional f)
-    (when v (ignore-errors (make-face-bold face)))))
-(unless (fboundp 'set-face-italic-p)
-  (defun set-face-italic-p (face v &optional f)
-    (when v (ignore-errors (make-face-italic face)))))
-
-;; doesn't exist in Emacs < 20.1
-(ignore-errors (require 'custom))
-(unless (fboundp 'defgroup)
-  (defmacro defgroup (&rest rest) ()))
-(unless (fboundp 'defcustom)
-  (defmacro defcustom (sym val str &rest rest) `(defvar ,sym ,val ,str)))
-(unless (fboundp 'defface)
-  (defmacro defface (sym val str &rest rest)
-    `(defvar ,sym (make-face ',sym) ,str)))
-
-(defvar :group ':group)
-(defvar :type ':type)
-(defvar :copy ':copy)
-(defvar :dense ':dense)
-(defvar :inherit ':inherit)
-(defvar :suppress ':suppress)
-
-(provide 'sml-compat)
-
-;;; sml-compat.el ends here
index 38ec9962d534c4d616a370f63b571ff847566253..0f42991a8da9e0917cd1756bf537b8f127c4c101 100644 (file)
@@ -1,6 +1,6 @@
 ;;; sml-defs.el --- Various definitions for sml-mode
 
-;; Copyright (C) 1999,2000,2003,2005,2007  Stefan Monnier <monnier@gnu.org>
+;; Copyright (C) 1999,2000,2003,2005,2007,2012  Stefan Monnier
 ;;
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -22,8 +22,6 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl))
-(require 'sml-util)
-
 
 (defgroup sml ()
   "Editing SML code."
@@ -40,37 +38,48 @@ notion of \"the end of an outline\".")
 ;;; Internal defines
 ;;; 
 
-(defmap sml-mode-map
-  ;; smarter cursor movement
-  '((forward-sexp      . sml-user-forward-sexp)
-    (backward-sexp     . sml-user-backward-sexp)
+(defvar sml-mode-map
+  (let ((map (make-sparse-keymap)))
+    ;; Smarter cursor movement.
+    ;; (define-key map [remap forward-sexp] 'sml-user-forward-sexp)
+    ;; (define-key map [remap backward-sexp] 'sml-user-backward-sexp)
     ;; Text-formatting commands:
-    ("\C-c\C-m"        . sml-insert-form)
-    ("\C-c\C-i"        . sml-mode-info)
-    ("\M-|"    . sml-electric-pipe)
-    ("\M-\ "   . sml-electric-space)
-    ("\;"      . sml-electric-semi)
-    ("\M-\t"   . sml-back-to-outer-indent)
+    (define-key map "\C-c\C-m" 'sml-insert-form)
+    (define-key map "\C-c\C-i" 'sml-mode-info)
+    (define-key map "\M-|" 'sml-electric-pipe)
+    (define-key map "\M-\ " 'sml-electric-space)
+    (define-key map "\;" 'sml-electric-semi)
+    (define-key map "\M-\t" 'sml-back-to-outer-indent)
     ;; Process commands added to sml-mode-map -- these should autoload
-    ("\C-c\C-l"        . sml-load-file)
-    ("\C-c\C-c" . sml-compile)
-    ("\C-c\C-s" . switch-to-sml)
-    ("\C-c\C-r" . sml-send-region)
-    ("\C-c\C-b" . sml-send-buffer)
-    ([(meta shift down-mouse-1)] . sml-drag-region))
-  "The keymap used in `sml-mode'."
-  ;; :inherit sml-bindings
-  :group 'sml)
-
-(defsyntax sml-mode-syntax-table
-  `((?\*   . ,(if sml-builtin-nested-comments-flag ". 23n" ". 23"))
-    (?\(   . "()1")
-    (?\)   . ")(4")
-    ("._'" . "_")
-    (",;"  . ".")
+    (define-key map "\C-c\C-l" 'sml-load-file)
+    (define-key map "\C-c\C-c" 'sml-compile)
+    (define-key map "\C-c\C-s" 'switch-to-sml)
+    (define-key map "\C-c\C-r" 'sml-send-region)
+    (define-key map "\C-c\C-b" 'sml-send-buffer)
+    (define-key map [(meta shift down-mouse-1)] 'sml-drag-region)
+    map)
+  "The keymap used in `sml-mode'.")
+
+(defconst sml-builtin-nested-comments-flag
+  (ignore-errors
+    (not (equal (let ((st (make-syntax-table)))
+                 (modify-syntax-entry ?\* ". 23n" st) st)
+               (let ((st (make-syntax-table)))
+                 (modify-syntax-entry ?\* ". 23" st) st))))
+  "Non-nil means this Emacs understands the `n' in syntax entries.")
+
+(defvar sml-mode-syntax-table
+  (let ((st (make-syntax-table)))
+    (modify-syntax-entry ?\* (if sml-builtin-nested-comments-flag
+                                 ". 23n" ". 23") st)
+    (modify-syntax-entry ?\( "()1" st)
+    (modify-syntax-entry ?\) ")(4" st)
+    (mapc (lambda (c) (modify-syntax-entry c "_" st)) "._'")
+    (mapc (lambda (c) (modify-syntax-entry c "." st)) ",;")
     ;; `!' is not really a prefix-char, oh well!
-    ("~#!" . "'")
-    ("%&$+-/:<=>?@`^|"  . "."))
+    (mapc (lambda (c) (modify-syntax-entry c "'"  st)) "~#!")
+    (mapc (lambda (c) (modify-syntax-entry c "."  st)) "%&$+-/:<=>?@`^|")
+    st)
   "The syntax table used in `sml-mode'.")
 
 
@@ -170,6 +179,18 @@ notion of \"the end of an outline\".")
   (concat "\\S.|\\S.\\|" (sml-syms-re (cdr sml-=-starter-syms)))
   "Symbols that can be followed by a `='.")
 
+(defun sml-preproc-alist (al)
+  "Expand an alist AL where keys can be lists of keys into a normal one."
+  (reduce (lambda (x al)
+           (let ((k (car x))
+                 (v (cdr x)))
+             (if (consp k)
+                 (append (mapcar (lambda (y) (cons y v)) k) al)
+               (cons x al))))
+         al
+         :initial-value nil
+         :from-end t))
+
 (defconst sml-indent-rule
   (sml-preproc-alist
    `(("struct" . 0)
index 7e3e783075adab967d9a5fc6630d7ca64695aca8..e193a3112cd23c8fa662d24f5bbeb3f3a14e85b7 100644 (file)
@@ -13,8 +13,6 @@
 ;;      (Stefan Monnier) <monnier@iro.umontreal.ca>
 ;; Maintainer: (Stefan Monnier) <monnier@iro.umontreal.ca>
 ;; Keywords: SML
-;; $Revision$
-;; $Date$
 
 ;; This file is not part of GNU Emacs, but it is distributed under the
 ;; same conditions.
@@ -70,7 +68,6 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl))
-(require 'sml-util)
 (require 'sml-move)
 (require 'sml-defs)
 
@@ -324,8 +321,11 @@ Regexp match data 0 points to the chars."
 ;; Code to handle nested comments and unusual string escape sequences
 ;;
 
-(defsyntax sml-syntax-prop-table
-  '((?\\ . ".") (?* . "."))
+(defvar sml-syntax-prop-table
+  (let ((st (make-syntax-table)))
+    (modify-syntax-entry ?\\ "." st)
+    (modify-syntax-entry ?* "." st)
+    st)
   "Syntax table for text-properties")
 
 ;; For Emacsen that have no built-in support for nested comments
@@ -1211,7 +1211,7 @@ If the point directly precedes a symbol for which an SML form exists,
 the corresponding form is inserted."
   (interactive)
   (let ((abbrev-mode (not abbrev-mode))
-       (last-command-char ?\ )
+       (last-command-event ?\ )
        ;; Bind `this-command' to fool skeleton's special abbrev handling.
        (this-command 'self-insert-command))
     (call-interactively 'self-insert-command)))
@@ -1371,7 +1371,8 @@ See also `edit-kbd-macro' which is bound to \\[edit-kbd-macro]."
         (let ((line (string-to-number (match-string 3)))
               (char (string-to-number (match-string 4))))
           (pop-to-buffer (find-file-noselect (match-string 2)))
-          (goto-line line)
+          (goto-char (point-min))
+          (forward-line (1- line))
           (forward-char (1- char)))))))
 
 ;;;
old mode 100755 (executable)
new mode 100644 (file)
index 8813dc098922fe1bf19d68a2973298cbad3b9919..f40630b2e45fda6932d5abf8881b2b34ac19b108 100644 (file)
@@ -1,6 +1,6 @@
 ;;; sml-move.el --- Buffer navigation functions for sml-mode
 
-;; Copyright (C) 1999, 2000, 2004, 2007  Stefan Monnier <monnier@gnu.org>
+;; Copyright (C) 1999,2000,2004,2007,2012  Stefan Monnier <monnier@gnu.org>
 ;;
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;;; Code:
 
 (eval-when-compile (require 'cl))
-(require 'sml-util)
 (require 'sml-defs)
 
-(defsyntax sml-internal-syntax-table
-  '((?_  . "w")
-    (?'  . "w")
-    (?.  . "w")
-    ;; treating `~' as a word constituent is not quite right, but
+(defvar sml-internal-syntax-table
+  (let ((st (make-syntax-table sml-mode-syntax-table)))
+    (modify-syntax-entry ?_ "w" st)
+    (modify-syntax-entry ?' "w" st)
+    (modify-syntax-entry ?. "w" st)
+    ;; Treating `~' as a word constituent is not quite right, but
     ;; close enough.  Think about 12.3E~2 for example.  Also `~' on its
     ;; own *is* a nonfix symbol.
-    (?~  . "w"))
-  "Syntax table used for internal sml-mode operation."
-  :copy sml-mode-syntax-table)
+    (modify-syntax-entry ?~ "w" st)
+    st)
+  "Syntax table used for internal sml-mode operation.")
 
 ;;; 
 ;;; various macros
@@ -156,7 +156,7 @@ This assumes that we are `looking-at' the OP."
     t))
 
 ;;; 
-;;; read a symbol, including the special "op <sym>" case
+;;; Read a symbol, including the special "op <sym>" case
 ;;; 
 
 (defmacro sml-move-read (&rest body)
index a25ffe73d16ad87225b84a0ca9ddbe170c0460f2..bdcd444b5cd4ad424c25327375cfdfc6ac1529d4 100644 (file)
@@ -1,12 +1,9 @@
 ;;; sml-proc.el --- Comint based interaction mode for Standard ML.
 
-;; Copyright (C) 1999, 2000, 2003, 2004, 2005, 2007  Stefan Monnier
+;; Copyright (C) 1999,2000,2003,2004,2005,2007,2012  Stefan Monnier
 ;; Copyright (C) 1994-1997  Matthew J. Morley
 ;; Copyright (C) 1989       Lars Bo Nielsen
 
-;; $Revision$
-;; $Date$
-
 ;; ====================================================================
 
 ;; This file is not part of GNU Emacs, but it is distributed under the
@@ -91,7 +88,6 @@
 
 (eval-when-compile (require 'cl))
 (require 'sml-mode)
-(require 'sml-util)
 (require 'comint)
 (require 'compile)
 
@@ -262,14 +258,16 @@ See `compilation-error-regexp-alist' for a description of the format.")
 
 ;;; CODE
 
-(defmap inferior-sml-mode-map
-  '(("\C-c\C-s"        . run-sml)
-    ("\C-c\C-l"        . sml-load-file)
-    ("\t"      . comint-dynamic-complete))
-  "Keymap for inferior-sml mode"
-  :inherit comint-mode-map
-  :group 'sml-proc)
-
+(defvar inferior-sml-mode-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map comint-mode-map)
+    (define-key map "\C-c\C-s" 'run-sml)
+    (define-key map "\C-c\C-l" 'sml-load-file)
+    (define-key map "\t"
+      (if (fboundp 'completion-at-point)
+          'completion-at-point 'comint-dynamic-complete))
+    map)
+  "Keymap for inferior-sml mode")
 
 ;; buffer-local
 
diff --git a/sml-util.el b/sml-util.el
deleted file mode 100644 (file)
index 99f8937..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-;;; sml-util.el --- Utility functions for sml-mode
-
-;; Copyright (C) 1999-2000, 2007, 2010  Stefan Monnier <monnier@iro.umontreal.ca>
-;;
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3 of the License, or
-;; (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program; if not, write to the Free Software
-;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-
-;;; Commentary:
-
-;;; Code:
-
-(require 'cl)                          ;for `reduce'
-(require 'sml-compat)
-
-(defun sml-preproc-alist (al)
-  "Expand an alist AL where keys can be lists of keys into a normal one."
-  (reduce (lambda (x al)
-           (let ((k (car x))
-                 (v (cdr x)))
-             (if (consp k)
-                 (append (mapcar (lambda (y) (cons y v)) k) al)
-               (cons x al))))
-         al
-         :initial-value nil
-         :from-end t))
-
-;;; 
-;;; defmap
-;;; 
-
-(defun custom-create-map (m bs args)
-  (let (inherit dense suppress)
-    (while args
-      (let ((key (first args))
-           (val (second args)))
-       (cond
-        ((eq key :dense) (setq dense val))
-        ((eq key :inherit) (setq inherit val))
-        ((eq key :group) )
-        ;;((eq key :suppress) (setq suppress val))
-        (t (message "Uknown argument %s in defmap" key))))
-      (setq args (cddr args)))
-    (unless (keymapp m)
-      (setq bs (append m bs))
-      (setq m (if dense (make-keymap) (make-sparse-keymap))))
-    (dolist (b bs)
-      (let ((keys (car b))
-           (binding (cdr b)))
-       (dolist (key (if (consp keys) keys (list keys)))
-         (cond
-          ((symbolp key)
-           (substitute-key-definition key binding m global-map))
-          ((null binding)
-           (unless (keymapp (lookup-key m key)) (define-key m key binding)))
-          ((let ((o (lookup-key m key)))
-             (or (null o) (numberp o) (eq o 'undefined)))
-           (define-key m key binding))))))
-    (cond
-     ((keymapp inherit) (set-keymap-parent m inherit))
-     ((consp inherit) (set-keymap-parents m inherit)))
-    m))
-
-(defmacro defmap (m bs doc &rest args)
-  `(defvar ,m
-     (custom-create-map (if (boundp ',m) ,m) ,bs ,(cons 'list args))
-     ,doc))
-
-;; defsyntax ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defun custom-create-syntax (css args)
-  (let ((st (make-syntax-table (cadr (memq :copy args)))))
-    (dolist (cs css)
-      (let ((char (car cs))
-           (syntax (cdr cs)))
-       (if (sequencep char)
-           (mapcar* (lambda (c) (modify-syntax-entry c syntax st)) char)
-         (modify-syntax-entry char syntax st))))
-    st))
-
-(defmacro defsyntax (st css doc &rest args)
-  `(defvar ,st (custom-create-syntax ,css ,(cons 'list args)) ,doc))
-
-;;;; 
-;;;; Compatibility info
-;;;; 
-
-(defvar sml-builtin-nested-comments-flag
-  (ignore-errors
-    (not (equal (let ((st (make-syntax-table)))
-                 (modify-syntax-entry ?\* ". 23n" st) st)
-               (let ((st (make-syntax-table)))
-                 (modify-syntax-entry ?\* ". 23" st) st))))
-  "Non-nil means this Emacs understands the `n' in syntax entries.")
-
-(provide 'sml-util)
-
-;;; sml-util.el ends here