File: pc-select.el.html
This package emulates the mark, copy, cut and paste look-and-feel of motif programs (which is the same as the MAC gui and (sorry for that) MS-Windows). It modifies the keybindings of the cursor keys and the next, prior, home and end keys. They will modify mark-active. You can still get the old behavior of cursor moving with the control sequences C-f, C-b, etc. This package uses transient-mark-mode and delete-selection-mode.
In addition to that all key-bindings from the pc-mode are done here too (as suggested by RMS).
As I found out after I finished the first version, s-region.el tries to do the same.... But my code is a little more complete and using delete-selection-mode is very important for the look-and-feel. Pete Forman <pete.forman@airgun.wg.waii.com> provided some motif compliant keybindings which I added. I had to modify them a little to add the -mark and -nomark functionality of cursor moving.
Credits: Many thanks to all who made comments. Thanks to RMS and Ralf Muschall <prm@rz.uni-jena.de> for criticism. Kevin Cutts <cutts@ukraine.corp.mot.com> added the beginning-of-buffer and end-of-buffer functions which I modified a little. David Biesack <sasdjb@unx.sas.com> suggested some more cleanup. Thanks to Pete Forman <pete.forman@airgun.wg.waii.com> for additional motif keybindings. Thanks to jvromans@squirrel.nl (Johan Vromans) for a bug report concerning setting of this-command. Dan Nicolaescu <done@ece.arizona.ro> suggested suppressing the scroll-up/scroll-down error. Eli Barzilay (eli@cs.bgu.ac.il) suggested the sexps functions and keybindings.
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
the mark.
o If you press "Shift" together with the "move-keys", the region
you pass along is activated
o You have the copy, cut and paste functions (as in many other programs)
which will operate on the active region
It was not possible to bind them to C-v, C-x and C-c for obvious
emacs reasons.
They will be bound according to the "old" behavior to S-delete (cut),
S-insert (paste) and C-insert (copy). These keys do the same in many
other programs.
Defined variables (14)
pc-select-default-key-bindings | These key bindings always get set by PC Selection mode. |
pc-select-extra-key-bindings | Key bindings to set only if ‘pc-select-selection-keys-only’ is nil. |
pc-select-key-bindings-alist | This alist holds all the key bindings PC Selection mode sets. |
pc-select-map | The keymap used as the global map when PC Selection mode is on. |
pc-select-meta-moves-sexps | Non-nil means move sexp-wise with Meta key, otherwise move word-wise. |
pc-select-meta-moves-sexps-key-bindings | The list of key bindings controlled by ‘pc-select-meta-moves-sexp’. |
pc-select-old-M-delete-binding | Holds the old mapping of [M-delete] in the ‘function-key-map’. |
pc-select-override-scroll-error | Non-nil means don’t generate error on scrolling past edge of buffer. |
pc-select-saved-global-map | The global map that was in effect when PC Selection mode was toggled on. |
pc-select-saved-settings-alist | The values of the variables before PC Selection mode was toggled on. |
pc-select-selection-keys-only | Non-nil means only bind the basic selection keys when started. |
pc-select-tty-key-bindings | The list of key bindings controlled by ‘pc-select-selection-keys-only’. |
pc-selection-mode | Non-nil if Pc-Selection mode is enabled. |
pc-selection-mode-hook | The hook to run when PC Selection mode is toggled. |
Defined functions (8)
pc-select-add-to-alist | (ALIST VAR VAL) |
pc-select-define-keys | (ALIST KEYMAP) |
pc-select-restore-keys | (ALIST KEYMAP SAVED-MAP) |
pc-select-restore-mode | (MODE) |
pc-select-restore-var | (VAR) |
pc-select-save-and-set-mode | (MODE &optional ARG MODE-VAR) |
pc-select-save-and-set-var | (VAR NEWVAL) |
pc-selection-mode | (&optional ARG) |