diff lisp/abbrev.el @ 446:1ccc32a20af4 r21-2-38

Import from CVS: tag r21-2-38
author cvs
date Mon, 13 Aug 2007 11:37:21 +0200
parents 576fb035e263
children a634e3b7acc8
line wrap: on
line diff
--- a/lisp/abbrev.el	Mon Aug 13 11:36:20 2007 +0200
+++ b/lisp/abbrev.el	Mon Aug 13 11:37:21 2007 +0200
@@ -88,15 +88,9 @@
   "Define an abbrev in TABLE named NAME, to expand to EXPANSION or call HOOK.
 NAME and EXPANSION are strings.  Hook is a function or `nil'.
 To undefine an abbrev, define it with an expansion of `nil'."
-  (unless (or (null expansion) (stringp expansion))
-    (setq expansion (wrong-type-argument 'stringp expansion)))
-
-  (unless (or (null count) (integerp count))
-    (setq count (wrong-type-argument 'fixnump count)))
-
-  (unless (vectorp table)
-    (setq table (wrong-type-argument 'vectorp table)))
-
+  (check-type expansion (or null string))
+  (check-type count (or null integer))
+  (check-type table vector)
   (let* ((sym (intern name table))
          (oexp (and (boundp sym) (symbol-value sym)))
          (ohook (and (fboundp sym) (symbol-function sym))))
@@ -426,7 +420,7 @@
        (buffer-substring
 	(point)
 	(if (= arg 0) (mark)
-	  (save-excursion (forward-word (- arg)) (point))))))
+	  (save-excursion (backward-word arg) (point))))))
 
 (defun add-mode-abbrev (arg)
   "Define mode-specific abbrev for last word(s) before point.
@@ -484,7 +478,7 @@
 ARG is the argument to `inverse-add-global-abbrev' or
 `inverse-add-mode-abbrev'."
   (save-excursion
-    (forward-word (- arg))
+    (backward-word arg)
     (buffer-substring (point) (progn (forward-word 1) (point)))))
 
 (defun inverse-add-mode-abbrev (arg)
@@ -511,7 +505,7 @@
 (defun inverse-add-abbrev (table type arg)
   (let (name nameloc exp)
     (save-excursion
-     (forward-word (- arg))
+     (backward-word arg)
      (setq name (buffer-substring (point) (progn (forward-word 1)
 					       (setq nameloc (point))))))
     (set-text-properties 0 (length name) nil name)
@@ -554,7 +548,7 @@
 	(if (abbrev-expansion
 	     (setq string
 		   (buffer-substring
-		    (save-excursion (forward-word -1) (point))
+		    (save-excursion (backward-word) (point))
 		    pnt)))
 	    (if (or noquery (y-or-n-p (format "Expand `%s'? " string)))
 		(expand-abbrev)))))))