diff lisp/abbrev.el @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 2f8bb876ab1d
children
line wrap: on
line diff
--- a/lisp/abbrev.el	Mon Aug 13 11:19:22 2007 +0200
+++ b/lisp/abbrev.el	Mon Aug 13 11:20:41 2007 +0200
@@ -419,17 +419,6 @@
    (write-region 1 (point-max) file)
    (erase-buffer)))
 
-(defun abbrev-string-to-be-defined (arg)
-  "Return the string for which an abbrev will be defined.
-ARG is the argument to `add-global-abbrev' or `add-mode-abbrev'."
-  (if (and (not arg) (region-active-p)) (setq arg 0)
-    (setq arg (prefix-numeric-value arg)))
-  (and (>= arg 0)
-       (buffer-substring
-	(point)
-	(if (= arg 0) (mark)
-	  (save-excursion (forward-word (- arg)) (point))))))
-
 (defun add-mode-abbrev (arg)
   "Define mode-specific abbrev for last word(s) before point.
 Argument is how many words before point form the expansion;
@@ -461,7 +450,13 @@
 
 (defun add-abbrev (table type arg)
   ;; XEmacs change:
-  (let ((exp (abbrev-string-to-be-defined arg))
+  (if (and (not arg) (region-active-p)) (setq arg 0)
+    (setq arg (prefix-numeric-value arg)))
+  (let ((exp (and (>= arg 0)
+		  (buffer-substring
+		   (point)
+		   (if (= arg 0) (mark)
+		     (save-excursion (forward-word (- arg)) (point))))))
 	name)
     (setq name
 	  (read-string (format (if exp "%s abbrev for \"%s\": "
@@ -474,14 +469,6 @@
 			      name (abbrev-expansion name table))))
 	(define-abbrev table (downcase name) exp))))
 
-(defun inverse-abbrev-string-to-be-defined (arg)
-  "Return the string for which an inverse abbrev will be defined.
-ARG is the argument to `inverse-add-global-abbrev' or
-`inverse-add-mode-abbrev'."
-  (save-excursion
-    (forward-word (- arg))
-    (buffer-substring (point) (progn (forward-word 1) (point)))))
-
 (defun inverse-add-mode-abbrev (arg)
   "Define last word before point as a mode-specific abbrev.
 With prefix argument N, defines the Nth word before point.