+errors are suppressed."
+ :type 'boolean
+ :group 'pc-select)
+
+(defcustom pc-select-selection-keys-only nil
+ "*Non-nil means only bind the basic selection keys when started.
+Other keys that emulate pc-behavior will be untouched.
+This gives mostly Emacs-like behavior with only the selection keys enabled."
+ :type 'boolean
+ :group 'pc-select)
+
+(defcustom pc-select-meta-moves-sexps nil
+ "*Non-nil means move sexp-wise with Meta key, otherwise move word-wise."
+ :type 'boolean
+ :group 'pc-select)
+
+(defcustom pc-selection-mode-hook nil
+ "The hook to run when pc-selection-mode is toggled."
+ :type 'hook
+ :group 'pc-select)
+
+(defvar pc-select-saved-settings-alist nil
+ "The values of the variables before PC Selection mode was toggled on.
+When PC Selection mode is toggled on, it sets quite a few variables
+for its own purposes. This alist holds the original values of the
+variables PC Selection mode had set, so that these variables can be
+restored to their original values when PC Selection mode is toggled off.")
+
+(defvar pc-select-map nil
+ "The keymap used as the global map when PC Selection mode is on." )
+
+(defvar pc-select-saved-global-map nil
+ "The global map that was in effect when PC Selection mode was toggled on.")
+
+(defvar pc-select-key-bindings-alist nil
+ "This alist holds all the key bindings PC Selection mode sets.")
+
+(defvar pc-select-default-key-bindings nil
+ "These key bindings always get set by PC Selection mode.")
+
+(unless pc-select-default-key-bindings
+ (let ((lst
+ ;; This is to avoid confusion with the delete-selection-mode
+ ;; On simple displays you cant see that a region is active and
+ ;; will be deleted on the next keypress IMHO especially for
+ ;; copy-region-as-kill this is confusing.
+ ;; The same goes for exchange-point-and-mark
+ '(("\M-w" . copy-region-as-kill-nomark)
+ ("\C-x\C-x" . exchange-point-and-mark-nomark)
+ ([S-right] . forward-char-mark)
+ ([right] . forward-char-nomark)
+ ([C-S-right] . forward-word-mark)
+ ([C-right] . forward-word-nomark)
+ ([S-left] . backward-char-mark)
+ ([left] . backward-char-nomark)
+ ([C-S-left] . backward-word-mark)
+ ([C-left] . backward-word-nomark)
+ ([S-down] . next-line-mark)
+ ([down] . next-line-nomark)
+
+ ([S-end] . end-of-line-mark)
+ ([end] . end-of-line-nomark)
+ ([S-C-end] . end-of-buffer-mark)
+ ([C-end] . end-of-buffer-nomark)
+ ([S-M-end] . end-of-buffer-mark)
+ ([M-end] . end-of-buffer-nomark)
+
+ ([S-next] . scroll-up-mark)
+ ([next] . scroll-up-nomark)
+
+ ([S-up] . previous-line-mark)
+ ([up] . previous-line-nomark)
+
+ ([S-home] . beginning-of-line-mark)
+ ([home] . beginning-of-line-nomark)
+ ([S-C-home] . beginning-of-buffer-mark)
+ ([C-home] . beginning-of-buffer-nomark)
+ ([S-M-home] . beginning-of-buffer-mark)
+ ([M-home] . beginning-of-buffer-nomark)
+
+ ([M-S-down] . forward-line-mark)
+ ([M-down] . forward-line-nomark)
+ ([M-S-up] . backward-line-mark)
+ ([M-up] . backward-line-nomark)
+
+ ([S-prior] . scroll-down-mark)
+ ([prior] . scroll-down-nomark)
+
+ ;; Next four lines are from Pete Forman.
+ ([C-down] . forward-paragraph-nomark) ; KNextPara cDn
+ ([C-up] . backward-paragraph-nomark) ; KPrevPara cUp
+ ([S-C-down] . forward-paragraph-mark)
+ ([S-C-up] . backward-paragraph-mark))))
+
+ (setq pc-select-default-key-bindings lst)))
+
+(defvar pc-select-extra-key-bindings nil
+ "Key bindings to set only if `pc-select-selection-keys-only' is nil.")
+
+;; The following keybindings are for standard ISO keyboards
+;; as they are used with IBM compatible PCs, IBM RS/6000,
+;; MACs, many X-Stations and probably more
+(unless pc-select-extra-key-bindings
+ (let ((lst
+ '(([S-insert] . yank)
+ ([C-insert] . copy-region-as-kill)
+ ([S-delete] . kill-region)
+
+ ;; The following bindings are useful on Sun Type 3 keyboards
+ ;; They implement the Get-Delete-Put (copy-cut-paste)
+ ;; functions from sunview on the L6, L8 and L10 keys
+ ;; Sam Steingold <sds@gnu.org> says that f16 is copy and f18 is paste.
+ ([f16] . copy-region-as-kill)
+ ([f18] . yank)
+ ([f20] . kill-region)
+
+ ;; The following bindings are from Pete Forman.
+ ([f6] . other-window) ; KNextPane F6
+ ([C-delete] . kill-line) ; KEraseEndLine cDel
+ ("\M-\d" . undo) ; KUndo aBS
+
+ ;; The following binding is taken from pc-mode.el
+ ;; as suggested by RMS.
+ ;; I only used the one that is not covered above.
+ ([C-M-delete] . kill-sexp)
+ ;; Next line proposed by Eli Barzilay
+ ([C-escape] . electric-buffer-list))))
+
+ (setq pc-select-extra-key-bindings lst)))
+
+(defvar pc-select-meta-moves-sexps-key-bindings
+ '((([M-S-right] . forward-sexp-mark)
+ ([M-right] . forward-sexp-nomark)
+ ([M-S-left] . backward-sexp-mark)
+ ([M-left] . backward-sexp-nomark))
+ (([M-S-right] . forward-word-mark)
+ ([M-right] . forward-word-nomark)
+ ([M-S-left] . backward-word-mark)
+ ([M-left] . backward-word-nomark)))
+ "The list of key bindings controlled by `pc-select-meta-moves-sexp'.
+The bindings in the car of this list get installed if
+`pc-select-meta-moves-sexp' is t, the bindings in the cadr of this
+list get installed otherwise.")
+
+;; This is for tty. We don't turn on normal-erase-is-backspace,
+;; but bind keys as pc-selection-mode did before
+;; normal-erase-is-backspace was invented, to keep us back
+;; compatible.
+(defvar pc-select-tty-key-bindings
+ '(([delete] . delete-char) ; KDelete Del
+ ([C-backspace] . backward-kill-word))
+ "The list of key bindings controlled by `pc-select-selection-keys-only'.
+These key bindings get installed when running in a tty, but only if
+`pc-select-selection-keys-only' is nil.")
+
+(defvar pc-select-old-M-delete-binding nil
+ "Holds the old mapping of [M-delete] in the `function-key-map'.
+This variable holds the value associated with [M-delete] in the
+`function-key-map' before PC Selection mode had changed that
+association.")