comparison lisp/emulation/pc-select.el @ 42980:6134751ae11f

(pc-selection-mode-hook) (pc-select-saved-settings-alist, pc-select-map) (pc-select-saved-global-map, pc-select-key-bindings-alist) (pc-select-default-key-bindings, pc-select-extra-key-bindings) (pc-select-meta-moves-sexps-key-bindings) (pc-select-tty-key-bindings, pc-select-old-M-delete-binding): New variables. (pc-select-define-keys, pc-select-restore-keys): New functions. (pc-select-add-to-alist, pc-select-save-and-set-var) (pc-select-save-and-set-mode, pc-select-restore-var) (pc-select-restore-mode): New macros. (pc-selection-mode): Completely rewrote the body of the function; the main goal was to make pc-selection-mode "turn-off"-able, like other minor modes. Use define-minore-mode instead of just a defun. Store the key bindings into four alists: pc-select-default-key-bindings, pc-select-extra-key-bindings, pc-select-meta-moves-sexps-key-bindings, and pc-select-tty-key-bindings; then have the pc-select-define-keys function walk those alists instead of calling define-key repeatedly. When the mode is turned on, set the keybindings in global-map and remember the old keybindings; when the mode is turned off, restore the previously-saved keybindings. (pc-selection-mode defcustom): Reflect the fact that the mode is now "turn-off"-able.
author Richard M. Stallman <rms@gnu.org>
date Sat, 26 Jan 2002 22:47:39 +0000
parents 77b08a460f84
children 32f6fb5c961f
comparison
equal deleted inserted replaced
42979:7359d6d75a9c 42980:6134751ae11f
1 ;;; pc-select.el --- emulate mark, cut, copy and paste from Motif 1 ;;; pc-select.el --- emulate mark, cut, copy and paste from Motif
2 ;;; (or MAC GUI or MS-windoze (bah)) look-and-feel 2 ;;; (or MAC GUI or MS-windoze (bah)) look-and-feel
3 ;;; including key bindings. 3 ;;; including key bindings.
4 4
5 ;; Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc. 5 ;; Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
6 6
7 ;; Author: Michael Staats <michael@thp.Uni-Duisburg.DE> 7 ;; Author: Michael Staats <michael@thp.Uni-Duisburg.DE>
8 ;; Keywords: convenience emulation 8 ;; Keywords: convenience emulation
9 ;; Created: 26 Sep 1995 9 ;; Created: 26 Sep 1995
10 10
106 (defcustom pc-select-meta-moves-sexps nil 106 (defcustom pc-select-meta-moves-sexps nil
107 "*Non-nil means move sexp-wise with Meta key, otherwise move word-wise." 107 "*Non-nil means move sexp-wise with Meta key, otherwise move word-wise."
108 :type 'boolean 108 :type 'boolean
109 :group 'pc-select) 109 :group 'pc-select)
110 110
111 (defcustom pc-selection-mode-hook nil
112 "The hook to run when pc-selection-mode is toggled."
113 :type 'hook
114 :group 'pc-select)
115
116 (defvar pc-select-saved-settings-alist nil
117 "The values of the variables before `pc-selection-mode' was toggled on.
118 When `pc-selection-mode' is toggled on, it sets quite a few variables
119 for its own purposes. This alist holds the original values of the
120 variables `pc-selection-mode' had set, so that these variables can be
121 restored to their original values when `pc-selection-mode' is toggled off.")
122
123 (defvar pc-select-map nil
124 "The keymap used as the global map when `pc-selection-mode' is on." )
125
126 (defvar pc-select-saved-global-map nil
127 "The global map that was in effect when `pc-selection-mode' was toggled on.")
128
129 (defvar pc-select-key-bindings-alist nil
130 "This alist holds all the key bindings `pc-selection-mode' sets.")
131
132 (defvar pc-select-default-key-bindings nil
133 "These key bindings always get set by `pc-selection-mode'.")
134
135 (unless pc-select-default-key-bindings
136 (let ((lst
137 ;; This is to avoid confusion with the delete-selection-mode
138 ;; On simple displays you cant see that a region is active and
139 ;; will be deleted on the next keypress IMHO especially for
140 ;; copy-region-as-kill this is confusing.
141 ;; The same goes for exchange-point-and-mark
142 '(("\M-w" . copy-region-as-kill-nomark)
143 ("\C-x\C-x" . exchange-point-and-mark-nomark)
144 ([S-right] . forward-char-mark)
145 ([right] . forward-char-nomark)
146 ([C-S-right] . forward-word-mark)
147 ([C-right] . forward-word-nomark)
148 ([S-left] . backward-char-mark)
149 ([left] . backward-char-nomark)
150 ([C-S-left] . backward-word-mark)
151 ([C-left] . backward-word-nomark)
152 ([S-down] . next-line-mark)
153 ([down] . next-line-nomark)
154
155 ([S-end] . end-of-line-mark)
156 ([end] . end-of-line-nomark)
157 ([S-C-end] . end-of-buffer-mark)
158 ([C-end] . end-of-buffer-nomark)
159 ([S-M-end] . end-of-buffer-mark)
160 ([M-end] . end-of-buffer-nomark)
161
162 ([S-next] . scroll-up-mark)
163 ([next] . scroll-up-nomark)
164
165 ([S-up] . previous-line-mark)
166 ([up] . previous-line-nomark)
167
168 ([S-home] . beginning-of-line-mark)
169 ([home] . beginning-of-line-nomark)
170 ([S-C-home] . beginning-of-buffer-mark)
171 ([C-home] . beginning-of-buffer-nomark)
172 ([S-M-home] . beginning-of-buffer-mark)
173 ([M-home] . beginning-of-buffer-nomark)
174
175 ([M-S-down] . forward-line-mark)
176 ([M-down] . forward-line-nomark)
177 ([M-S-up] . backward-line-mark)
178 ([M-up] . backward-line-nomark)
179
180 ([S-prior] . scroll-down-mark)
181 ([prior] . scroll-down-nomark)
182
183 ;; Next four lines are from Pete Forman.
184 ([C-down] . forward-paragraph-nomark) ; KNextPara cDn
185 ([C-up] . backward-paragraph-nomark) ; KPrevPara cUp
186 ([S-C-down] . forward-paragraph-mark)
187 ([S-C-up] . backward-paragraph-mark))))
188
189 (setq pc-select-default-key-bindings lst)))
190
191 (defvar pc-select-extra-key-bindings nil
192 "Key bindings to set only if `pc-select-selection-keys-only' is nil.")
193
194 ;; The following keybindings are for standard ISO keyboards
195 ;; as they are used with IBM compatible PCs, IBM RS/6000,
196 ;; MACs, many X-Stations and probably more
197 (unless pc-select-extra-key-bindings
198 (let ((lst
199 '(([S-insert] . yank)
200 ([C-insert] . copy-region-as-kill)
201 ([S-delete] . kill-region)
202
203 ;; The following bindings are useful on Sun Type 3 keyboards
204 ;; They implement the Get-Delete-Put (copy-cut-paste)
205 ;; functions from sunview on the L6, L8 and L10 keys
206 ;; Sam Steingold <sds@gnu.org> says that f16 is copy and f18 is paste.
207 ([f16] . copy-region-as-kill)
208 ([f18] . yank)
209 ([f20] . kill-region)
210
211 ;; The following bindings are from Pete Forman.
212 ([f6] . other-window) ; KNextPane F6
213 ([C-delete] . kill-line) ; KEraseEndLine cDel
214 ("\M-\d" . undo) ; KUndo aBS
215
216 ;; The following binding is taken from pc-mode.el
217 ;; as suggested by RMS.
218 ;; I only used the one that is not covered above.
219 ([C-M-delete] . kill-sexp)
220 ;; Next line proposed by Eli Barzilay
221 ([C-escape] . electric-buffer-list))))
222
223 (setq pc-select-extra-key-bindings lst)))
224
225 (defvar pc-select-meta-moves-sexps-key-bindings
226 '((([M-S-right] . forward-sexp-mark)
227 ([M-right] . forward-sexp-nomark)
228 ([M-S-left] . backward-sexp-mark)
229 ([M-left] . backward-sexp-nomark))
230 (([M-S-right] . forward-word-mark)
231 ([M-right] . forward-word-nomark)
232 ([M-S-left] . backward-word-mark)
233 ([M-left] . backward-word-nomark)))
234 "The list of key bindings controlled by `pc-select-meta-moves-sexp'.
235 The bindings in the car of this list get installed if
236 `pc-select-meta-moves-sexp' is t, the bindings in the cadr of this
237 list get installed otherwise.")
238
239 ;; This is for tty. We don't turn on normal-erase-is-backspace,
240 ;; but bind keys as pc-selection-mode did before
241 ;; normal-erase-is-backspace was invented, to keep us back
242 ;; compatible.
243 (defvar pc-select-tty-key-bindings
244 '(([delete] . delete-char) ; KDelete Del
245 ([C-backspace] . backward-kill-word))
246 "The list of key bindings controlled by `pc-select-selection-keys-only'.
247 These key bindings get installed when running in a tty, but only if
248 `pc-select-selection-keys-only' is nil.")
249
250 (defvar pc-select-old-M-delete-binding nil
251 "Holds the old mapping of [M-delete] in the `function-key-map'.
252 This variable holds the value associated with [M-delete] in the
253 `function-key-map' before `pc-selection-mode' had changed that
254 association.")
255
111 ;;;; 256 ;;;;
112 ;; misc 257 ;; misc
113 ;;;; 258 ;;;;
114 259
115 (provide 'pc-select) 260 (provide 'pc-select)
604 (/ size 10)) 749 (/ size 10))
605 (/ (+ 10 (* size (prefix-numeric-value arg))) 10))) 750 (/ (+ 10 (* size (prefix-numeric-value arg))) 10)))
606 (point-min)))) 751 (point-min))))
607 (if arg (forward-line 1))) 752 (if arg (forward-line 1)))
608 753
754
755 (defun pc-select-define-keys (alist keymap)
756 "Make KEYMAP have the key bindings specified in ALIST."
757 (let ((lst alist))
758 (while lst
759 (define-key keymap (caar lst) (cdar lst))
760 (setq lst (cdr lst)))))
761
762 (defun pc-select-restore-keys (alist keymap saved-map)
763 "Use ALIST to restore key bindings from SAVED-MAP into KEYMAP.
764 Go through all the key bindings in ALIST, and, for each key
765 binding, if KEYMAP and ALIST still agree on the key binding,
766 restore the previous value of that key binding from SAVED-MAP."
767 (let ((lst alist))
768 (while lst
769 (when (equal (lookup-key keymap (caar lst)) (cdar lst))
770 (define-key keymap (caar lst) (lookup-key saved-map (caar lst))))
771 (setq lst (cdr lst)))))
772
773 (defmacro pc-select-add-to-alist (alist var val)
774 "Ensure that ALIST contains the cons cell (VAR . VAL).
775 If a cons cell whose car is VAR is already on the ALIST, update the
776 cdr of that cell with VAL. Otherwise, make a new cons cell
777 \(VAR . VAL), and prepend it onto ALIST."
778 (let ((elt (make-symbol "elt")))
779 `(let ((,elt (assq ',var ,alist)))
780 (if ,elt
781 (setcdr ,elt ,val)
782 (setq ,alist (cons (cons ',var ,val) ,alist))))))
783
784 (defmacro pc-select-save-and-set-var (var newval)
785 "Set VAR to NEWVAL; save the old value.
786 The old value is saved on the `pc-select-saved-settings-alist'."
787 `(when (boundp ',var)
788 (pc-select-add-to-alist pc-select-saved-settings-alist ,var ,var)
789 (setq ,var ,newval)))
790
791 (defmacro pc-select-save-and-set-mode (mode &optional arg mode-var)
792 "Call the function MODE; save the old value of the variable MODE.
793 MODE is presumed to be a function which turns on a minor mode. First,
794 save the value of the variable MODE on `pc-select-saved-settings-alist'.
795 Then, if ARG is specified, call MODE with ARG, otherwise call it with
796 nil as an argument. If MODE-VAR is specified, save the value of the
797 variable MODE-VAR (instead of the value of the variable MODE) on
798 `pc-select-saved-settings-alist'."
799 `(when (fboundp ',mode)
800 (pc-select-add-to-alist pc-select-saved-settings-alist
801 ,mode
802 (or (and (boundp ',mode) ,mode)
803 ,mode-var))
804 (,mode ,arg)))
805
806 (defmacro pc-select-restore-var (var)
807 "Restore the previous value of the variable VAR.
808 Look up VAR's previous value in `pc-select-saved-settings-alist', and,
809 if the value is found, set VAR to that value."
810 (let ((elt (make-symbol "elt")))
811 `(let ((,elt (assq ',var pc-select-saved-settings-alist)))
812 (unless (null ,elt)
813 (setq ,var (cdr ,elt))))))
814
815 (defmacro pc-select-restore-mode (mode)
816 "Restore the previous state (either on or off) of the minor mode MODE.
817 Look up the value of the variable MODE on `pc-select-saved-settings-alist'.
818 If the value is non-nil, call the function MODE with an argument of
819 1, otherwise call it with an argument of -1."
820 (let ((elt (make-symbol "elt")))
821 `(when (fboundp ',mode)
822 (let ((,elt (assq ',mode pc-select-saved-settings-alist)))
823 (unless (null ,elt)
824 (,mode (if (cdr ,elt) 1 -1)))))))
825
826
609 ;;;###autoload 827 ;;;###autoload
610 (defun pc-selection-mode () 828 (define-minor-mode pc-selection-mode
611 "Change mark behaviour to emulate Motif, MAC or MS-Windows cut and paste style. 829 "Change mark behaviour to emulate Motif, MAC or MS-Windows cut and paste style.
612 830
613 This mode enables Delete Selection mode and Transient Mark mode. 831 This mode enables Delete Selection mode and Transient Mark mode.
614 832
615 The arrow keys (and others) are bound to new functions 833 The arrow keys (and others) are bound to new functions
647 865
648 In addition, certain other PC bindings are imitated (to avoid this, set 866 In addition, certain other PC bindings are imitated (to avoid this, set
649 the variable `pc-select-selection-keys-only' to t after loading pc-select.el 867 the variable `pc-select-selection-keys-only' to t after loading pc-select.el
650 but before calling `pc-selection-mode'): 868 but before calling `pc-selection-mode'):
651 869
652 F6 `other-window' 870 F6 other-window
653 DELETE `delete-char' 871 DELETE delete-char
654 C-DELETE `kill-line' 872 C-DELETE kill-line
655 M-DELETE `kill-word' 873 M-DELETE kill-word
656 C-M-DELETE `kill-sexp' 874 C-M-DELETE kill-sexp
657 C-BACKSPACE `backward-kill-word' 875 C-BACKSPACE backward-kill-word
658 M-BACKSPACE `undo'" 876 M-BACKSPACE undo"
659 ;; FIXME: make into a proper minor mode (i.e. undoable).
660 ;; FIXME: bring pc-bindings-mode here ? 877 ;; FIXME: bring pc-bindings-mode here ?
661 (interactive) 878 nil nil nil
662 ;; 879
663 ;; keybindings 880 :group 'pc-select
664 ;; 881 :global t
665 882
666 ;; This is to avoid confusion with the delete-selection-mode 883 (if pc-selection-mode
667 ;; On simple displays you can't see that a region is active and 884 (if (null pc-select-key-bindings-alist)
668 ;; will be deleted on the next keypress. IMHO especially for 885 (progn
669 ;; copy-region-as-kill this is confusing. 886 (setq pc-select-map (copy-keymap (current-global-map))
670 ;; The same goes for exchange-point-and-mark 887 pc-select-saved-global-map (copy-keymap (current-global-map)))
671 (define-key global-map "\M-w" 'copy-region-as-kill-nomark) 888
672 (define-key global-map "\C-x\C-x" 'exchange-point-and-mark-nomark) 889 (setq pc-select-key-bindings-alist
673 ;; The following keybindings are for standard ISO keyboards 890 (append pc-select-default-key-bindings
674 ;; as they are used with IBM compatible PCs, IBM RS/6000, 891 (if pc-select-selection-keys-only
675 ;; MACs, many X-Stations and probably more 892 nil
676 (define-key global-map [S-right] 'forward-char-mark) 893 pc-select-extra-key-bindings)
677 (define-key global-map [right] 'forward-char-nomark) 894 (if pc-select-meta-moves-sexps
678 (define-key global-map [C-S-right] 'forward-word-mark) 895 (car pc-select-meta-moves-sexps-key-bindings)
679 (define-key global-map [C-right] 'forward-word-nomark) 896 (cadr pc-select-meta-moves-sexps-key-bindings))
680 (define-key global-map [S-left] 'backward-char-mark) 897 (if (or pc-select-selection-keys-only
681 (define-key global-map [left] 'backward-char-nomark) 898 (eq window-system 'x)
682 (define-key global-map [C-S-left] 'backward-word-mark) 899 (memq system-name '(ms-dos windows-nt)))
683 (define-key global-map [C-left] 'backward-word-nomark) 900 nil
684 (cond (pc-select-meta-moves-sexps 901 pc-select-tty-key-bindings)))
685 (define-key global-map [M-S-right] 'forward-sexp-mark) 902
686 (define-key global-map [M-right] 'forward-sexp-nomark) 903 (pc-select-define-keys pc-select-key-bindings-alist pc-select-map)
687 (define-key global-map [M-S-left] 'backward-sexp-mark) 904 (use-global-map pc-select-map)
688 (define-key global-map [M-left] 'backward-sexp-nomark)) 905
689 (t 906 (unless (or pc-select-selection-keys-only
690 (define-key global-map [M-S-right] 'forward-word-mark) 907 (eq window-system 'x)
691 (define-key global-map [M-right] 'forward-word-nomark) 908 (memq system-name '(ms-dos windows-nt)))
692 (define-key global-map [M-S-left] 'backward-word-mark) 909 ;; it is not clear that we need the following line
693 (define-key global-map [M-left] 'backward-word-nomark))) 910 ;; I hope it doesn't do too much harm to leave it in, though...
694 911 (setq pc-select-old-M-delete-binding
695 (define-key global-map [S-down] 'next-line-mark) 912 (lookup-key function-key-map [M-delete]))
696 (define-key global-map [down] 'next-line-nomark) 913 (define-key function-key-map [M-delete] [?\M-d]))
697 914
698 (define-key global-map [S-end] 'end-of-line-mark) 915 (when (and (not pc-select-selection-keys-only)
699 (define-key global-map [end] 'end-of-line-nomark) 916 (or (eq window-system 'x)
700 (global-set-key [S-C-end] 'end-of-buffer-mark) 917 (memq system-name '(ms-dos windows-nt)))
701 (global-set-key [C-end] 'end-of-buffer-nomark) 918 (fboundp 'normal-erase-is-backspace-mode))
702 (global-set-key [S-M-end] 'end-of-buffer-mark) 919 (pc-select-save-and-set-mode normal-erase-is-backspace-mode 1
703 (global-set-key [M-end] 'end-of-buffer-nomark) 920 normal-erase-is-backspace))
704 921 ;; the original author also had this above:
705 (define-key global-map [S-next] 'scroll-up-mark) 922 ;; (setq-default normal-erase-is-backspace t)
706 (define-key global-map [next] 'scroll-up-nomark) 923 ;; However, the documentation for the variable says that
707 924 ;; "setting it with setq has no effect", so I'm removing it.
708 (define-key global-map [S-up] 'previous-line-mark) 925
709 (define-key global-map [up] 'previous-line-nomark) 926 (pc-select-save-and-set-var highlight-nonselected-windows nil)
710 927 (pc-select-save-and-set-var transient-mark-mode t)
711 (define-key global-map [S-home] 'beginning-of-line-mark) 928 (pc-select-save-and-set-var mark-even-if-inactive t)
712 (define-key global-map [home] 'beginning-of-line-nomark) 929 (pc-select-save-and-set-mode delete-selection-mode 1))
713 (global-set-key [S-C-home] 'beginning-of-buffer-mark) 930 ;;else
714 (global-set-key [C-home] 'beginning-of-buffer-nomark) 931 ;; If the user turned on pc-selection-mode a second time
715 (global-set-key [S-M-home] 'beginning-of-buffer-mark) 932 ;; do not clobber the values of the variables that were
716 (global-set-key [M-home] 'beginning-of-buffer-nomark) 933 ;; saved from before pc-selection mode was activated --
717 934 ;; just make sure the values are the way we like them.
718 (define-key global-map [M-S-down] 'forward-line-mark) 935 (setq pc-select-map (copy-keymap (current-global-map)))
719 (define-key global-map [M-down] 'forward-line-nomark) 936 (pc-select-define-keys pc-select-key-bindings-alist pc-select-map)
720 (define-key global-map [M-S-up] 'backward-line-mark) 937 (use-global-map pc-select-map)
721 (define-key global-map [M-up] 'backward-line-nomark) 938 (unless (or pc-select-selection-keys-only
722 939 (eq window-system 'x)
723 (define-key global-map [S-prior] 'scroll-down-mark) 940 (memq system-name '(ms-dos windows-nt)))
724 (define-key global-map [prior] 'scroll-down-nomark) 941 ;; it is not clear that we need the following line
725 942 ;; I hope it doesn't do too much harm to leave it in, though...
726 ;; Next four lines are from Pete Forman. 943 (define-key function-key-map [M-delete] [?\M-d]))
727 (global-set-key [C-down] 'forward-paragraph-nomark) ; KNextPara cDn 944 (when (and (not pc-select-selection-keys-only)
728 (global-set-key [C-up] 'backward-paragraph-nomark) ; KPrevPara cUp 945 (or (eq window-system 'x)
729 (global-set-key [S-C-down] 'forward-paragraph-mark) 946 (memq system-name '(ms-dos windows-nt)))
730 (global-set-key [S-C-up] 'backward-paragraph-mark) 947 (fboundp 'normal-erase-is-backspace-mode))
731
732 (unless pc-select-selection-keys-only
733 ;; We are behaving like normal-erase-is-backspace-mode, so
734 ;; say so explicitly. But don't do that on a Unix tty, since
735 ;; some of them have keyboards that by default already behave
736 ;; as if normal-erase-is-backspace mode is on, and turning it
737 ;; a second time screws them up.
738 (if (or (eq window-system 'x)
739 (memq system-name '(ms-dos windows-nt macos)))
740 (progn
741 (setq-default normal-erase-is-backspace t)
742 (normal-erase-is-backspace-mode 1)) 948 (normal-erase-is-backspace-mode 1))
743 ;; This is for tty. We don't turn on normal-erase-is-backspace, 949 (setq highlight-nonselected-windows nil)
744 ;; but bind keys as pc-selection-mode did before 950 (setq transient-mark-mode t)
745 ;; normal-erase-is-backspace was invented, to keep us back 951 (setq mark-even-if-inactive t)
746 ;; compatible. 952 (delete-selection-mode 1))
747 (global-set-key [delete] 'delete-char) ; KDelete Del 953 ;;else
748 (define-key function-key-map [M-delete] [?\M-d]) 954 (when pc-select-key-bindings-alist
749 (global-set-key [C-backspace] 'backward-kill-word)) 955 (when (and (not pc-select-selection-keys-only)
750 (define-key global-map [S-insert] 'yank) 956 (or (eq window-system 'x)
751 (define-key global-map [C-insert] 'copy-region-as-kill) 957 (memq system-name '(ms-dos windows-nt))))
752 (define-key global-map [S-delete] 'kill-region) 958 (pc-select-restore-mode normal-erase-is-backspace-mode))
753 959
754 ;; The following bindings are useful on Sun Type 3 keyboards 960 (setq pc-select-map (copy-keymap (current-global-map)))
755 ;; They implement the Get-Delete-Put (copy-cut-paste) 961 (pc-select-restore-keys
756 ;; functions from sunview on the L6, L8 and L10 keys 962 pc-select-key-bindings-alist pc-select-map pc-select-saved-global-map)
757 ;; Sam Steingold <sds@gnu.org> says that f16 is copy and f18 is paste. 963 (use-global-map pc-select-map)
758 (define-key global-map [f16] 'copy-region-as-kill) 964
759 (define-key global-map [f18] 'yank) 965 (pc-select-restore-var highlight-nonselected-windows)
760 (define-key global-map [f20] 'kill-region) 966 (pc-select-restore-var transient-mark-mode)
761 967 (pc-select-restore-var mark-even-if-inactive)
762 ;; The following bindings are from Pete Forman. 968 (pc-select-restore-mode delete-selection-mode)
763 (global-set-key [f6] 'other-window) ; KNextPane F6 969 (and pc-select-old-M-delete-binding
764 (global-set-key [C-delete] 'kill-line) ; KEraseEndLine cDel 970 (define-key function-key-map [M-delete]
765 (global-set-key "\M-\d" 'undo) ; KUndo aBS 971 pc-select-old-M-delete-binding))
766 972 (setq pc-select-key-bindings-alist nil
767 ;; The following binding is taken from pc-mode.el 973 pc-select-saved-settings-alist nil))))
768 ;; as suggested by RMS. 974
769 ;; I only used the one that is not covered above.
770 (global-set-key [C-M-delete] 'kill-sexp)
771 ;; Next line proposed by Eli Barzilay
772 (global-set-key [C-escape] 'electric-buffer-list))
773 ;;
774 ;; setup
775 ;;
776 ;; Next line proposed by Eli Barzilay
777 (setq highlight-nonselected-windows nil)
778 (transient-mark-mode 1)
779 (setq mark-even-if-inactive t)
780 (delete-selection-mode 1))
781 975
782 ;;;###autoload 976 ;;;###autoload
783 (defcustom pc-selection-mode nil 977 (defcustom pc-selection-mode nil
784 "Toggle PC Selection mode. 978 "Toggle PC Selection mode.
785 Change mark behaviour to emulate Motif, MAC or MS-Windows cut and paste style, 979 Change mark behaviour to emulate Motif, MAC or MS-Windows cut and paste style,
786 and cursor movement commands. 980 and cursor movement commands.
787 This mode enables Delete Selection mode and Transient Mark mode. 981 This mode enables Delete Selection mode and Transient Mark mode.
788 You must modify via \\[customize] for this variable to have an effect." 982 You must modify via \\[customize] for this variable to have an effect."
789 :set (lambda (symbol value) 983 :set (lambda (symbol value)
790 (if value (pc-selection-mode))) 984 (pc-selection-mode (if value 1 -1)))
985 :initialize 'custom-initialize-default
791 :type 'boolean 986 :type 'boolean
792 :group 'pc-select 987 :group 'pc-select
793 :require 'pc-select) 988 :require 'pc-select)
794 989
795 ;;; pc-select.el ends here 990 ;;; pc-select.el ends here