diff lisp/simple.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 3078fd1074e8
line wrap: on
line diff
--- a/lisp/simple.el	Mon Aug 13 11:36:20 2007 +0200
+++ b/lisp/simple.el	Mon Aug 13 11:37:21 2007 +0200
@@ -305,7 +305,7 @@
   (save-excursion
     (delete-horizontal-space)
     (if (or (looking-at "^\\|\\s)")
-	    (save-excursion (forward-char -1)
+	    (save-excursion (backward-char 1)
 			    (looking-at "$\\|\\s(\\|\\s'")))
 	nil
       (insert ?\ ))))
@@ -422,11 +422,11 @@
       (while (and (> count 0) (not (bobp)))
 	(if (eq (char-before (point)) ?\t) ; XEmacs
 	    (let ((col (current-column)))
-	      (forward-char -1)
+	      (backward-char 1)
 	      (setq col (- col (current-column)))
 	      (insert-char ?\ col)
 	      (delete-char 1)))
-	(forward-char -1)
+	(backward-char 1)
 	(setq count (1- count)))))
   (delete-backward-char arg killp)
   ;; XEmacs: In overwrite mode, back over columns while clearing them out,
@@ -440,11 +440,11 @@
   :type 'boolean
   :group 'editing-basics)
 
-(defcustom backward-delete-function 'backward-delete-char
+(defcustom backward-delete-function 'delete-backward-char
   "*Function called to delete backwards on a delete keypress.
 If `delete-key-deletes-forward' is nil, `backward-or-forward-delete-char'
 calls this function to erase one character backwards.  Default value
-is 'backward-delete-char, with 'backward-delete-char-untabify being a
+is `delete-backward-char', with `backward-delete-char-untabify' being a
 popular alternate setting."
   :type 'function
   :group 'editing-basics)
@@ -2346,7 +2346,7 @@
 and drag it forward past ARG other characters (backward if ARG negative).
 If no argument and at end of line, the previous two chars are exchanged."
   (interactive "*P")
-  (and (null arg) (eolp) (forward-char -1))
+  (and (null arg) (eolp) (backward-char 1))
   (transpose-subr 'forward-char (prefix-numeric-value arg)))
 
 ;;; A very old implementation of transpose-chars from the old days ...
@@ -2356,7 +2356,7 @@
 and drag it forward past ARG other characters (backward if ARG negative).
 If no argument and not at start of line, the previous two chars are exchanged."
   (interactive "*P")
-  (and (null arg) (not (bolp)) (forward-char -1))
+  (and (null arg) (not (bolp)) (backward-char 1))
   (transpose-subr 'forward-char (prefix-numeric-value arg)))
 
 
@@ -2731,31 +2731,32 @@
  	  (forward-char 1)))))
 
 
-;; XEmacs - extra parameter
-(defun backward-word (arg &optional buffer)
-  "Move backward until encountering the end of a word.
-With argument, do this that many times.
-In programs, it is faster to call `forward-word' with negative arg."
-  (interactive "_p") ; XEmacs
-  (forward-word (- arg) buffer))
-
-(defun mark-word (arg)
-  "Set mark arg words away from point."
+(defun backward-word (&optional count buffer)
+  "Move point backward COUNT words (forward if COUNT is negative).
+Normally t is returned, but if an edge of the buffer is reached,
+point is left there and nil is returned.
+
+COUNT defaults to 1, and BUFFER defaults to the current buffer."
+  (interactive "_p")
+  (forward-word (- (or count 1)) buffer))
+
+(defun mark-word (&optional count)
+  "Mark the text from point until encountering the end of a word.
+With optional argument COUNT, mark COUNT words."
   (interactive "p")
-  (mark-something 'mark-word 'forward-word arg))
-
-;; XEmacs modified
-(defun kill-word (arg)
+  (mark-something 'mark-word 'forward-word count))
+
+(defun kill-word (&optional count)
   "Kill characters forward until encountering the end of a word.
+With optional argument COUNT, do this that many times."
+  (interactive "*p")
+  (kill-region (point) (save-excursion (forward-word count) (point))))
+
+(defun backward-kill-word (&optional count)
+  "Kill characters backward until encountering the end of a word.
 With argument, do this that many times."
   (interactive "*p")
-  (kill-region (point) (save-excursion (forward-word arg) (point))))
-
-(defun backward-kill-word (arg)
-  "Kill characters backward until encountering the end of a word.
-With argument, do this that many times."
-  (interactive "*p") ; XEmacs
-  (kill-word (- arg)))
+  (kill-word (- (or count 1))))
 
 (defun current-word (&optional strict)
   "Return the word point is on (or a nearby word) as a string.
@@ -2852,7 +2853,7 @@
 				(and (not (bobp))
 				     (not bounce)
 				     sentence-end-double-space
-				     (save-excursion (forward-char -1)
+				     (save-excursion (backward-char 1)
 						     (and (looking-at "\\. ")
 							  (not (looking-at "\\.  "))))))
 		       (setq first nil)
@@ -2977,7 +2978,7 @@
 ;			      (and (not (bobp))
 ;				   (not bounce)
 ;				   sentence-end-double-space
-;				   (save-excursion (forward-char -1)
+;				   (save-excursion (backward-char 1)
 ;						   (and (looking-at "\\. ")
 ;							(not (looking-at "\\.  "))))))
 ;		     (setq first nil)
@@ -3143,7 +3144,7 @@
 	    (and comment-end (not (equal comment-end ""))
   ;	       (if (not comment-multi-line)
 		     (progn
-		       (forward-char -1)
+		       (backward-char 1)
 		       (insert comment-end)
 		       (forward-char 1))
   ;		 (setq comment-column (+ comment-column (length comment-start))
@@ -3153,7 +3154,7 @@
 	    (if (not (eolp))
 		(setq comment-end ""))
 	    (insert ?\n)
-	    (forward-char -1)
+	    (backward-char 1)
 	    (indent-for-comment)
 	    (save-excursion
 	      ;; Make sure we delete the newline inserted above.
@@ -3318,7 +3319,7 @@
        ;; Verify an even number of quoting characters precede the close.
        (= 1 (logand 1 (- (point)
 			 (save-excursion
-			   (forward-char -1)
+			   (backward-char 1)
 			   (skip-syntax-backward "/\\")
 			   (point)))))
        (let* ((oldpos (point))