update.
[chise/xemacs-chise.git.1] / lisp / simple.el
index 4ff4777..b0666a1 100644 (file)
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 1985-7, 1993-5, 1997 Free Software Foundation, Inc.
 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
-;; Copyright (C) 2000 Ben Wing.
+;; Copyright (C) 2000, 2001, 2002, 2003 Ben Wing.
 
 ;; Maintainer: XEmacs Development Team
 ;; Keywords: lisp, extensions, internal, dumped
@@ -298,6 +298,8 @@ With argument, join this line to following line."
            (delete-region (point) (+ (point) (length fill-prefix))))
        (fixup-whitespace))))
 
+(defalias 'join-line 'delete-indentation)
+
 (defun fixup-whitespace ()
   "Fixup white space between objects around point.
 Leave one space or none, according to the context."
@@ -1115,8 +1117,7 @@ Repeating \\[universal-argument] without digits or minus sign
 (defcustom kill-whole-line nil
   "*If non-nil, kill the whole line if point is at the beginning.
 Otherwise, `kill-line' kills only up to the end of the line, but not
-the terminating newline.  Note: This only applies when `kill-line' is
-called interactively.
+the terminating newline.
 
 WARNING: This is a misnamed variable!  It should be called something
 like `kill-whole-line-when-at-beginning'.  If you simply want
@@ -1125,7 +1126,7 @@ like `kill-whole-line-when-at-beginning'.  If you simply want
   :type 'boolean
   :group 'killing)
 
-(defun kill-line-1 (arg entire-line interactive-p)
+(defun kill-line-1 (arg entire-line)
   (kill-region (if entire-line
                   (save-excursion
                     (beginning-of-line)
@@ -1147,8 +1148,7 @@ like `kill-whole-line-when-at-beginning'.  If you simply want
                       (signal 'end-of-buffer nil))
                   (if (or (looking-at "[ \t]*$")
                           (or entire-line
-                              (and interactive-p
-                                   (and kill-whole-line (bolp)))))
+                              (and kill-whole-line (bolp))))
                       (forward-line 1)
                     (end-of-line)))
                 (point))))
@@ -1161,7 +1161,7 @@ arguments kill lines backward.
 When calling from a program, nil means \"no arg\",
 a number counts as a prefix arg."
   (interactive "*P")
-  (kill-line-1 arg t (interactive-p)))
+  (kill-line-1 arg t))
 
 (defun kill-line (&optional arg)
   "Kill the rest of the current line, or the entire line.
@@ -1177,7 +1177,7 @@ current line, use `kill-entire-line'.
 When calling from a program, nil means \"no arg\",
 a number counts as a prefix arg."
   (interactive "*P")
-  (kill-line-1 arg nil (interactive-p)))
+  (kill-line-1 arg nil))
 
 ;; XEmacs
 (defun backward-kill-line nil
@@ -1224,7 +1224,9 @@ The function takes one or two arguments.
 The first argument, TEXT, is a string containing
 the text which should be made available.
 The second, PUSH, if non-nil means this is a \"new\" kill;
-nil means appending to an \"old\" kill."
+nil means appending to an \"old\" kill.
+
+One reasonable choice is `own-clipboard' (the default)."
   :type '(radio (function-item :tag "Send to Clipboard"
                               :format "%t\n"
                               own-clipboard)
@@ -1232,7 +1234,7 @@ nil means appending to an \"old\" kill."
                (function :tag "Other"))
   :group 'killing)
 
-(defcustom interprogram-paste-function 'get-clipboard
+(defcustom interprogram-paste-function 'get-clipboard-foreign
   "Function to call to get text cut from other programs.
 
 Most window systems provide some sort of facility for cutting and
@@ -1250,10 +1252,13 @@ than Emacs has provided a string for pasting; if Emacs provided the
 most recent string, the function should return nil.  If it is
 difficult to tell whether Emacs or some other program provided the
 current string, it is probably good enough to return nil if the string
-is equal (according to `string=') to the last text Emacs provided."
+is equal (according to `string=') to the last text Emacs provided.
+
+Reasonable choices include `get-clipboard-foreign' (the default), and
+functions calling `get-selection-foreign' (q.v.)."
   :type '(radio (function-item :tag "Get from Clipboard"
                               :format "%t\n"
-                              get-clipboard)
+                              get-clipboard-foreign)
                (const :tag "None" nil)
                (function :tag "Other"))
   :group 'killing)
@@ -1961,7 +1966,7 @@ intervening text will be added to the active region.
 
 When the region has been enabled or augmented as a result of a shifted
 motion key, an unshifted motion key will normally deselect the region.
-However, if `unshifted-motion-keys-deselect-region' is t, the region
+However, if `unshifted-motion-keys-deselect-region' is nil, the region
 will remain active, augmented by the characters moved over by this
 motion key.
 
@@ -1983,8 +1988,12 @@ nil."
   :group 'editing-basics)
 
 (defcustom motion-keys-for-shifted-motion
-  '(left right up down home end prior next
-        kp-left kp-right kp-up kp-down kp-home kp-end kp-prior kp-next)
+  ;; meta-shift-home/end are NOT shifted motion commands.
+  '(left right up down (home) (control home) (meta control home)
+    (end) (control end) (meta control end) prior next
+    kp-left kp-right kp-up kp-down (kp-home) (control kp-home)
+    (meta control kp-home) (kp-end) (control kp-end) (meta control kp-end)
+    kp-prior kp-next)
   "*List of keys considered motion keys for the purpose of shifted selection.
 When one of these keys is pressed along with the Shift key, and the
 command invoked moves the cursor and preserves the active region (see
@@ -2005,11 +2014,20 @@ alphabetic key without problem, and you can specify the key using
 either a character or a symbol, uppercase or lowercase."
   :type '(repeat (choice (const :tag "normal cursor-pad (\"gray\") keys"
                                :inline t
-                               (left right up down home end prior next))
+                               (left
+                                right up down
+                                (home) (control home) (meta control home)
+                                (end) (control end) (meta control end)
+                                prior next))
                         (const :tag "keypad motion keys"
                                :inline t
-                               (kp-left kp-right kp-up kp-down
-                                        kp-home kp-end kp-prior kp-next))
+                               (kp-left
+                                kp-right kp-up kp-down
+                                (kp-home) (control kp-home)
+                                (meta control kp-home)
+                                (kp-end) (control kp-end)
+                                (meta control kp-end)
+                                kp-prior kp-next))
                         (const :tag "alphabetic motion keys"
                                :inline t
                                ((control b) (control f)
@@ -2088,9 +2106,7 @@ either a character or a symbol, uppercase or lowercase."
             (setq zmacs-region-stays t))
            ((and (getf last-command-properties 'shifted-motion-command)
                  unshifted-motion-keys-deselect-region)
-            (setq zmacs-region-stays nil))
-           (t
-            (setq zmacs-region-stays t)))))
+            (setq zmacs-region-stays nil)))))
 
 (defun forward-char-command (&optional arg buffer)
   "Move point right ARG characters (left if ARG negative) in BUFFER.
@@ -3870,15 +3886,30 @@ If active regions are in use (i.e. `zmacs-regions' is true), this means that
  the region is active.  Otherwise, this means that the user has pushed
  a mark in this buffer at some point in the past.
 The functions `region-beginning' and `region-end' can be used to find the
- limits of the region."
+ limits of the region.
+
+You should use this, *NOT* `region-active-p', in a menu item
+specification that you want grayed out when the region is not active:
+
+  [ ... ... :active (region-exists-p)]
+
+This correctly caters to the user's setting of `zmacs-regions'."
   (not (null (mark))))
 
 ;; XEmacs
 (defun region-active-p ()
-  "Return non-nil if the region is active.
+  "Return non-nil if the region is active in the current buffer.
 If `zmacs-regions' is true, this is equivalent to `region-exists-p'.
-Otherwise, this function always returns false."
-  (and zmacs-regions zmacs-region-extent))
+Otherwise, this function always returns false.
+
+You should generally *NOT* use this in a menu item specification that you
+want grayed out when the region is not active.  Instead, use this:
+
+  [ ... ... :active (region-exists-p)]
+
+Which correctly caters to the user's setting of `zmacs-regions'."
+  (and zmacs-regions zmacs-region-extent
+       (eq (current-buffer) (zmacs-region-buffer))))
 
 (defvar zmacs-activate-region-hook nil
   "Function or functions called when the region becomes active;