* progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
[bpt/emacs.git] / lisp / emulation / pc-select.el
index aa50706..a4e3046 100644 (file)
@@ -2,7 +2,8 @@
 ;;;                 (or MAC GUI or MS-windoze (bah)) look-and-feel
 ;;;                 including key bindings.
 
-;; Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004,
+;;   2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Author: Michael Staats <michael@thp.Uni-Duisburg.DE>
 ;; Keywords: convenience emulation
@@ -12,7 +13,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -22,8 +23,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -61,7 +62,7 @@
 ;; Eli Barzilay (eli@cs.bgu.ac.il) suggested the sexps functions and
 ;; keybindings.
 ;;
-;; Ok, some details about the idea of pc-selection-mode:
+;; Ok, some details about the idea of PC Selection mode:
 ;;
 ;;  o The standard keys for moving around (right, left, up, down, home, end,
 ;;    prior, next, called "move-keys" from now on) will always de-activate
@@ -99,7 +100,7 @@ errors are suppressed."
 (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 behaviour with only the selection keys enabled."
+This gives mostly Emacs-like behavior with only the selection keys enabled."
   :type 'boolean
   :group 'pc-select)
 
@@ -114,23 +115,23 @@ This gives mostly Emacs-like behaviour with only the selection keys enabled."
   :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
+  "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.")
+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." )
+  "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.")
+  "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.")
+  "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'.")
+  "These key bindings always get set by PC Selection mode.")
 
 (unless pc-select-default-key-bindings
   (let ((lst
@@ -185,7 +186,7 @@ restored to their original values when `pc-selection-mode' is toggled off.")
           ([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
@@ -219,7 +220,7 @@ restored to their original values when `pc-selection-mode' is toggled off.")
           ([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
@@ -250,7 +251,7 @@ These key bindings get installed when running in a tty, but only if
 (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
+`function-key-map' before PC Selection mode had changed that
 association.")
 
 ;;;;
@@ -350,7 +351,7 @@ Then it does not try to move vertically.  This goal column is stored
 in `goal-column', which is nil when there is none."
   (interactive "p")
   (ensure-mark)
-  (next-line arg)
+  (with-no-warnings (next-line arg))
   (setq this-command 'next-line))
 
 (defun end-of-line-mark (&optional arg)
@@ -483,7 +484,7 @@ Then it does not try to move vertically.  This goal column is stored
 in `goal-column', which is nil when there is none."
   (interactive "p")
   (setq mark-active nil)
-  (next-line arg)
+  (with-no-warnings (next-line arg))
   (setq this-command 'next-line))
 
 (defun end-of-line-nomark (&optional arg)
@@ -608,7 +609,7 @@ If you are thinking of using this in a Lisp program, consider using
 to use and more reliable (no dependence on goal column, etc.)."
   (interactive "p")
   (ensure-mark)
-  (previous-line arg)
+  (with-no-warnings (previous-line arg))
   (setq this-command 'previous-line))
 
 (defun beginning-of-line-mark (&optional arg)
@@ -706,7 +707,7 @@ a semipermanent goal column to which this command always moves.
 Then it does not try to move vertically."
   (interactive "p")
   (setq mark-active nil)
-  (previous-line arg)
+  (with-no-warnings (previous-line arg))
   (setq this-command 'previous-line))
 
 (defun beginning-of-line-nomark (&optional arg)
@@ -773,7 +774,7 @@ restore the previous value of that key binding from SAVED-MAP."
 (defmacro pc-select-add-to-alist (alist var val)
   "Ensure that ALIST contains the cons cell (VAR . VAL).
 If a cons cell whose car is VAR is already on the ALIST, update the
-cdr of that cell with VAL.  Otherwise, make a new cons cell 
+cdr of that cell with VAL.  Otherwise, make a new cons cell
 \(VAR . VAL), and prepend it onto ALIST."
   (let ((elt (make-symbol "elt")))
     `(let ((,elt (assq ',var ,alist)))
@@ -803,7 +804,7 @@ variable MODE-VAR (instead of the value of the variable MODE) on
      (,mode ,arg)))
 
 (defmacro pc-select-restore-var (var)
-  "Restore the previous value of the variable VAR. 
+  "Restore the previous value of the variable VAR.
 Look up VAR's previous value in `pc-select-saved-settings-alist', and,
 if the value is found, set VAR to that value."
   (let ((elt (make-symbol "elt")))
@@ -825,7 +826,7 @@ If the value is non-nil, call the function MODE with an argument of
 
 ;;;###autoload
 (define-minor-mode pc-selection-mode
-  "Change mark behaviour to emulate Motif, MAC or MS-Windows cut and paste style.
+  "Change mark behavior to emulate Motif, MAC or MS-Windows cut and paste style.
 
 This mode enables Delete Selection mode and Transient Mark mode.
 
@@ -842,7 +843,7 @@ M-LEFT and M-RIGHT move back or forward one word or sexp, disabling the mark.
 S-M-LEFT and S-M-RIGHT move back or forward one word or sexp, leaving the mark
 behind.  To control whether these keys move word-wise or sexp-wise set the
 variable `pc-select-meta-moves-sexps' after loading pc-select.el but before
-turning `pc-selection-mode' on.
+turning PC Selection mode on.
 
 C-DOWN and C-UP move back or forward a paragraph, disabling the mark.
 S-C-DOWN and S-C-UP move back or forward a paragraph, leaving the mark behind.
@@ -864,7 +865,7 @@ C-INSERT copies the region into the kill ring (`copy-region-as-kill').
 
 In addition, certain other PC bindings are imitated (to avoid this, set
 the variable `pc-select-selection-keys-only' to t after loading pc-select.el
-but before calling `pc-selection-mode'):
+but before calling PC Selection mode):
 
   F6           other-window
   DELETE       delete-char
@@ -882,9 +883,7 @@ but before calling `pc-selection-mode'):
   (if pc-selection-mode
       (if (null pc-select-key-bindings-alist)
          (progn
-           (setq pc-select-map (copy-keymap (current-global-map))
-                 pc-select-saved-global-map (copy-keymap (current-global-map)))
-             
+           (setq pc-select-saved-global-map (copy-keymap (current-global-map)))
            (setq pc-select-key-bindings-alist
                  (append pc-select-default-key-bindings
                          (if pc-select-selection-keys-only
@@ -899,14 +898,14 @@ but before calling `pc-selection-mode'):
                              nil
                            pc-select-tty-key-bindings)))
 
-           (pc-select-define-keys pc-select-key-bindings-alist pc-select-map)
-           (use-global-map pc-select-map)
+           (pc-select-define-keys pc-select-key-bindings-alist
+                                  (current-global-map))
 
            (unless  (or pc-select-selection-keys-only
                         (eq window-system 'x)
                         (memq system-name '(ms-dos windows-nt)))
              ;; it is not clear that we need the following line
-       ;; I hope it doesn't do too much harm to leave it in, though...
+             ;; I hope it doesn't do too much harm to leave it in, though...
              (setq pc-select-old-M-delete-binding
                    (lookup-key function-key-map [M-delete]))
              (define-key function-key-map  [M-delete] [?\M-d]))
@@ -920,8 +919,8 @@ but before calling `pc-selection-mode'):
            ;; the original author also had this above:
            ;; (setq-default normal-erase-is-backspace t)
            ;; However, the documentation for the variable says that
-         ;; "setting it with setq has no effect", so I'm removing it.
-      
+           ;; "setting it with setq has no effect", so I'm removing it.
+
            (pc-select-save-and-set-var highlight-nonselected-windows nil)
            (pc-select-save-and-set-var transient-mark-mode t)
            (pc-select-save-and-set-var mark-even-if-inactive t)
@@ -931,14 +930,13 @@ but before calling `pc-selection-mode'):
        ;; do not clobber the values of the variables that were
        ;; saved from before pc-selection mode was activated --
        ;; just make sure the values are the way we like them.
-       (setq pc-select-map (copy-keymap (current-global-map)))
-       (pc-select-define-keys pc-select-key-bindings-alist pc-select-map)
-       (use-global-map pc-select-map)
+       (pc-select-define-keys pc-select-key-bindings-alist
+                              (current-global-map))
        (unless  (or pc-select-selection-keys-only
                     (eq window-system 'x)
                     (memq system-name '(ms-dos windows-nt)))
          ;; it is not clear that we need the following line
-       ;; I hope it doesn't do too much harm to leave it in, though...
+         ;; I hope it doesn't do too much harm to leave it in, though...
          (define-key function-key-map  [M-delete] [?\M-d]))
        (when (and (not pc-select-selection-keys-only)
                   (or (eq window-system 'x)
@@ -956,10 +954,9 @@ but before calling `pc-selection-mode'):
                     (memq system-name '(ms-dos windows-nt))))
        (pc-select-restore-mode normal-erase-is-backspace-mode))
 
-      (setq pc-select-map (copy-keymap (current-global-map)))
       (pc-select-restore-keys
-       pc-select-key-bindings-alist pc-select-map pc-select-saved-global-map)
-      (use-global-map pc-select-map)
+       pc-select-key-bindings-alist (current-global-map)
+       pc-select-saved-global-map)
 
       (pc-select-restore-var highlight-nonselected-windows)
       (pc-select-restore-var transient-mark-mode)
@@ -970,15 +967,16 @@ but before calling `pc-selection-mode'):
             pc-select-old-M-delete-binding))
       (setq pc-select-key-bindings-alist nil
            pc-select-saved-settings-alist nil))))
-  
+
 
 ;;;###autoload
 (defcustom pc-selection-mode nil
   "Toggle PC Selection mode.
-Change mark behaviour to emulate Motif, MAC or MS-Windows cut and paste style,
+Change mark behavior to emulate Motif, MAC or MS-Windows cut and paste style,
 and cursor movement commands.
 This mode enables Delete Selection mode and Transient Mark mode.
-You must modify via \\[customize] for this variable to have an effect."
+Setting this variable directly does not take effect;
+you must modify it using \\[customize] or \\[pc-selection-mode]."
   :set (lambda (symbol value)
         (pc-selection-mode (if value 1 -1)))
   :initialize 'custom-initialize-default
@@ -986,4 +984,5 @@ You must modify via \\[customize] for this variable to have an effect."
   :group 'pc-select
   :require 'pc-select)
 
+;;; arch-tag: 10697b70-ae07-4f3e-ad23-7814a3f418c2
 ;;; pc-select.el ends here