(vc-update-change-log): Doc fix.
[emacs.git] / lisp / emulation / pc-select.el
bloba9ca70482436bfef62b45c0274a5c638c117f3d2
1 ;;; pc-select.el --- emulate mark, cut, copy and paste from motif
2 ;;; (or MAC GUI) or MS-windoze (bah)) look-and-feel
3 ;;; including key bindings
5 ;; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
7 ;; Author: Michael Staats <michael@thp.Uni-Duisburg.DE>
8 ;; Created: 26 Sep 1995
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
27 ;;; Commentary:
29 ;; This package emulates the mark, copy, cut and paste look-and-feel of motif
30 ;; programs (which is the same as the MAC gui and (sorry for that) MS-Windows).
31 ;; It modifies the keybindings of the cursor keys and the next, prior,
32 ;; home and end keys. They will modify mark-active.
33 ;; You can still get the old behaviour of cursor moving with the
34 ;; control sequences C-f, C-b, etc.
35 ;; This package uses transient-mark-mode and
36 ;; delete-selection-mode.
38 ;; In addition to that all key-bindings from the pc-mode are
39 ;; done here too (as suggested by RMS).
41 ;; As I found out after I finished the first version, s-region.el tries
42 ;; to do the same.... But my code is a little more complete and using
43 ;; delete-selection-mode is very important for the look-and-feel.
44 ;; Pete Forman <pete.forman@airgun.wg.waii.com> provided some motif
45 ;; compliant keybindings which I added. I had to modify them a little
46 ;; to add the -mark and -nomark functionality of cursor moving.
48 ;; Credits:
49 ;; Many thanks to all who made comments.
50 ;; Thanks to RMS and Ralf Muschall <prm@rz.uni-jena.de> for criticism.
51 ;; Kevin Cutts <cutts@ukraine.corp.mot.com> added the beginning-of-buffer
52 ;; and end-of-buffer functions which I modified a little.
53 ;; David Biesack <sasdjb@unx.sas.com> suggested some more cleanup.
54 ;; Thanks to Pete Forman <pete.forman@airgun.wg.waii.com>
55 ;; for additional motif keybindings.
56 ;; Thanks to jvromans@squirrel.nl (Johan Vromans) for a bug report
57 ;; concerning setting of this-command.
58 ;; Dan Nicolaescu <done@nexus.sorostm.ro> suggested suppressing the
59 ;; scroll-up/scroll-down error.
61 ;; Ok, some details about the idea of pc-selection-mode:
63 ;; o The standard keys for moving around (right, left, up, down, home, end,
64 ;; prior, next, called "move-keys" from now on) will always de-activate
65 ;; the mark.
66 ;; o If you press "Shift" together with the "move-keys", the region
67 ;; you pass along is activated
68 ;; o You have the copy, cut and paste functions (as in many other programs)
69 ;; which will operate on the active region
70 ;; It was not possible to bind them to C-v, C-x and C-c for obvious
71 ;; emacs reasons.
72 ;; They will be bound according to the "old" behaviour to S-delete (cut),
73 ;; S-insert (paste) and C-insert (copy). These keys do the same in many
74 ;; other programs.
77 ;;;; Customization:
79 (defvar pc-select-override-scroll-error t
80 "*Non-nil means don't generate error on scrolling past edge of buffer.
81 This variable applies in PC Selection mode only.
82 The scroll commands normally generate an error if you try to scroll
83 past the top or bottom of the buffer. This is annoying when selecting
84 text with these commands. If you set this variable to non-nil, these
85 errors are suppressed.")
87 ;;;;
88 ;; misc
89 ;;;;
91 (provide 'pc-select)
93 (defun copy-region-as-kill-nomark (beg end)
94 "Save the region as if killed; but don't kill it; deactivate mark.
95 If `interprogram-cut-function' is non-nil, also save the text for a window
96 system cut and paste.
98 Deactivating mark is to avoid confusion with delete-selection-mode
99 and transient-mark-mode."
100 (interactive "r")
101 (copy-region-as-kill beg end)
102 (setq mark-active nil)
103 (message "Region saved"))
105 ;;;;
106 ;; non-interactive
107 ;;;;
108 (defun ensure-mark()
109 ;; make sure mark is active
110 ;; test if it is active, if it isn't, set it and activate it
111 (or mark-active (set-mark-command nil)))
113 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
114 ;;;;; forward and mark
115 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
117 (defun forward-char-mark (&optional arg)
118 "Ensure mark is active; move point right ARG characters (left if ARG negative).
119 On reaching end of buffer, stop and signal error."
120 (interactive "p")
121 (ensure-mark)
122 (forward-char arg))
124 (defun forward-word-mark (&optional arg)
125 "Ensure mark is active; move point right ARG words (backward if ARG is negative).
126 Normally returns t.
127 If an edge of the buffer is reached, point is left there
128 and nil is returned."
129 (interactive "p")
130 (ensure-mark)
131 (forward-word arg))
133 (defun forward-line-mark (&optional arg)
134 "Ensure mark is active; move cursor vertically down ARG lines."
135 (interactive "p")
136 (ensure-mark)
137 (forward-line arg)
138 (setq this-command 'forward-line)
141 (defun forward-paragraph-mark (&optional arg)
142 "Ensure mark is active; move forward to end of paragraph.
143 With arg N, do it N times; negative arg -N means move backward N paragraphs.
145 A line which `paragraph-start' matches either separates paragraphs
146 \(if `paragraph-separate' matches it also) or is the first line of a paragraph.
147 A paragraph end is the beginning of a line which is not part of the paragraph
148 to which the end of the previous line belongs, or the end of the buffer."
149 (interactive "p")
150 (ensure-mark)
151 (forward-paragraph arg))
153 (defun next-line-mark (&optional arg)
154 "Ensure mark is active; move cursor vertically down ARG lines.
155 If there is no character in the target line exactly under the current column,
156 the cursor is positioned after the character in that line which spans this
157 column, or at the end of the line if it is not long enough.
158 If there is no line in the buffer after this one, behavior depends on the
159 value of `next-line-add-newlines'. If non-nil, it inserts a newline character
160 to create a line, and moves the cursor to that line. Otherwise it moves the
161 cursor to the end of the buffer \(if already at the end of the buffer, an error
162 is signaled).
164 The command C-x C-n can be used to create
165 a semipermanent goal column to which this command always moves.
166 Then it does not try to move vertically. This goal column is stored
167 in `goal-column', which is nil when there is none."
168 (interactive "p")
169 (ensure-mark)
170 (next-line arg)
171 (setq this-command 'next-line))
173 (defun end-of-line-mark (&optional arg)
174 "Ensure mark is active; move point to end of current line.
175 With argument ARG not nil or 1, move forward ARG - 1 lines first.
176 If scan reaches end of buffer, stop there without error."
177 (interactive "p")
178 (ensure-mark)
179 (end-of-line arg)
180 (setq this-command 'end-of-line))
182 (defun backward-line-mark (&optional arg)
183 "Ensure mark is active; move cursor vertically up ARG lines."
184 (interactive "p")
185 (ensure-mark)
186 (if (null arg)
187 (setq arg 1))
188 (forward-line (- arg))
189 (setq this-command 'forward-line)
192 (defun scroll-down-mark (&optional arg)
193 "Ensure mark is active; scroll down ARG lines; or near full screen if no ARG.
194 A near full screen is `next-screen-context-lines' less than a full screen.
195 Negative ARG means scroll upward.
196 When calling from a program, supply a number as argument or nil."
197 (interactive "P")
198 (ensure-mark)
199 (cond (pc-select-override-scroll-error
200 (condition-case nil (scroll-down arg)
201 (beginning-of-buffer (goto-char (point-min)))))
202 (t (scroll-down arg))))
204 (defun end-of-buffer-mark (&optional arg)
205 "Ensure mark is active; move point to the end of the buffer.
206 With arg N, put point N/10 of the way from the end.
208 If the buffer is narrowed, this command uses the beginning and size
209 of the accessible part of the buffer.
211 Don't use this command in Lisp programs!
212 \(goto-char \(point-max)) is faster and avoids clobbering the mark."
213 (interactive "P")
214 (ensure-mark)
215 (let ((size (- (point-max) (point-min))))
216 (goto-char (if arg
217 (- (point-max)
218 (if (> size 10000)
219 ;; Avoid overflow for large buffer sizes!
220 (* (prefix-numeric-value arg)
221 (/ size 10))
222 (/ (* size (prefix-numeric-value arg)) 10)))
223 (point-max))))
224 ;; If we went to a place in the middle of the buffer,
225 ;; adjust it to the beginning of a line.
226 (if arg (forward-line 1)
227 ;; If the end of the buffer is not already on the screen,
228 ;; then scroll specially to put it near, but not at, the bottom.
229 (if (let ((old-point (point)))
230 (save-excursion
231 (goto-char (window-start))
232 (vertical-motion (window-height))
233 (< (point) old-point)))
234 (progn
235 (overlay-recenter (point))
236 (recenter -3)))))
238 ;;;;;;;;;
239 ;;;;; no mark
240 ;;;;;;;;;
242 (defun forward-char-nomark (&optional arg)
243 "Deactivate mark; move point right ARG characters \(left if ARG negative).
244 On reaching end of buffer, stop and signal error."
245 (interactive "p")
246 (setq mark-active nil)
247 (forward-char arg))
249 (defun forward-word-nomark (&optional arg)
250 "Deactivate mark; move point right ARG words \(backward if ARG is negative).
251 Normally returns t.
252 If an edge of the buffer is reached, point is left there
253 and nil is returned."
254 (interactive "p")
255 (setq mark-active nil)
256 (forward-word arg))
258 (defun forward-line-nomark (&optional arg)
259 "Deactivate mark; move cursor vertically down ARG lines."
260 (interactive "p")
261 (setq mark-active nil)
262 (forward-line arg)
263 (setq this-command 'forward-line)
266 (defun forward-paragraph-nomark (&optional arg)
267 "Deactivate mark; move forward to end of paragraph.
268 With arg N, do it N times; negative arg -N means move backward N paragraphs.
270 A line which `paragraph-start' matches either separates paragraphs
271 \(if `paragraph-separate' matches it also) or is the first line of a paragraph.
272 A paragraph end is the beginning of a line which is not part of the paragraph
273 to which the end of the previous line belongs, or the end of the buffer."
274 (interactive "p")
275 (setq mark-active nil)
276 (forward-paragraph arg))
278 (defun next-line-nomark (&optional arg)
279 "Deactivate mark; move cursor vertically down ARG lines.
280 If there is no character in the target line exactly under the current column,
281 the cursor is positioned after the character in that line which spans this
282 column, or at the end of the line if it is not long enough.
283 If there is no line in the buffer after this one, behavior depends on the
284 value of `next-line-add-newlines'. If non-nil, it inserts a newline character
285 to create a line, and moves the cursor to that line. Otherwise it moves the
286 cursor to the end of the buffer (if already at the end of the buffer, an error
287 is signaled).
289 The command C-x C-n can be used to create
290 a semipermanent goal column to which this command always moves.
291 Then it does not try to move vertically. This goal column is stored
292 in `goal-column', which is nil when there is none."
293 (interactive "p")
294 (setq mark-active nil)
295 (next-line arg)
296 (setq this-command 'next-line))
298 (defun end-of-line-nomark (&optional arg)
299 "Deactivate mark; move point to end of current line.
300 With argument ARG not nil or 1, move forward ARG - 1 lines first.
301 If scan reaches end of buffer, stop there without error."
302 (interactive "p")
303 (setq mark-active nil)
304 (end-of-line arg)
305 (setq this-command 'end-of-line))
307 (defun backward-line-nomark (&optional arg)
308 "Deactivate mark; move cursor vertically up ARG lines."
309 (interactive "p")
310 (setq mark-active nil)
311 (if (null arg)
312 (setq arg 1))
313 (forward-line (- arg))
314 (setq this-command 'forward-line)
317 (defun scroll-down-nomark (&optional arg)
318 "Deactivate mark; scroll down ARG lines; or near full screen if no ARG.
319 A near full screen is `next-screen-context-lines' less than a full screen.
320 Negative ARG means scroll upward.
321 When calling from a program, supply a number as argument or nil."
322 (interactive "P")
323 (setq mark-active nil)
324 (cond (pc-select-override-scroll-error
325 (condition-case nil (scroll-down arg)
326 (beginning-of-buffer (goto-char (point-min)))))
327 (t (scroll-down arg))))
329 (defun end-of-buffer-nomark (&optional arg)
330 "Deactivate mark; move point to the end of the buffer.
331 With arg N, put point N/10 of the way from the end.
333 If the buffer is narrowed, this command uses the beginning and size
334 of the accessible part of the buffer.
336 Don't use this command in Lisp programs!
337 \(goto-char (point-max)) is faster and avoids clobbering the mark."
338 (interactive "P")
339 (setq mark-active nil)
340 (let ((size (- (point-max) (point-min))))
341 (goto-char (if arg
342 (- (point-max)
343 (if (> size 10000)
344 ;; Avoid overflow for large buffer sizes!
345 (* (prefix-numeric-value arg)
346 (/ size 10))
347 (/ (* size (prefix-numeric-value arg)) 10)))
348 (point-max))))
349 ;; If we went to a place in the middle of the buffer,
350 ;; adjust it to the beginning of a line.
351 (if arg (forward-line 1)
352 ;; If the end of the buffer is not already on the screen,
353 ;; then scroll specially to put it near, but not at, the bottom.
354 (if (let ((old-point (point)))
355 (save-excursion
356 (goto-char (window-start))
357 (vertical-motion (window-height))
358 (< (point) old-point)))
359 (progn
360 (overlay-recenter (point))
361 (recenter -3)))))
364 ;;;;;;;;;;;;;;;;;;;;
365 ;;;;;; backwards and mark
366 ;;;;;;;;;;;;;;;;;;;;
368 (defun backward-char-mark (&optional arg)
369 "Ensure mark is active; move point left ARG characters (right if ARG negative).
370 On attempt to pass beginning or end of buffer, stop and signal error."
371 (interactive "p")
372 (ensure-mark)
373 (backward-char arg))
375 (defun backward-word-mark (&optional arg)
376 "Ensure mark is active; move backward until encountering the end of a word.
377 With argument, do this that many times."
378 (interactive "p")
379 (ensure-mark)
380 (backward-word arg))
382 (defun backward-paragraph-mark (&optional arg)
383 "Ensure mark is active; move backward to start of paragraph.
384 With arg N, do it N times; negative arg -N means move forward N paragraphs.
386 A paragraph start is the beginning of a line which is a
387 `first-line-of-paragraph' or which is ordinary text and follows a
388 paragraph-separating line; except: if the first real line of a
389 paragraph is preceded by a blank line, the paragraph starts at that
390 blank line.
392 See `forward-paragraph' for more information."
393 (interactive "p")
394 (ensure-mark)
395 (backward-paragraph arg))
397 (defun previous-line-mark (&optional arg)
398 "Ensure mark is active; move cursor vertically up ARG lines.
399 If there is no character in the target line exactly over the current column,
400 the cursor is positioned after the character in that line which spans this
401 column, or at the end of the line if it is not long enough.
403 The command C-x C-n can be used to create
404 a semipermanent goal column to which this command always moves.
405 Then it does not try to move vertically.
407 If you are thinking of using this in a Lisp program, consider using
408 `forward-line' with a negative argument instead. It is usually easier
409 to use and more reliable (no dependence on goal column, etc.)."
410 (interactive "p")
411 (ensure-mark)
412 (previous-line arg)
413 (setq this-command 'previous-line))
415 (defun beginning-of-line-mark (&optional arg)
416 "Ensure mark is active; move point to beginning of current line.
417 With argument ARG not nil or 1, move forward ARG - 1 lines first.
418 If scan reaches end of buffer, stop there without error."
419 (interactive "p")
420 (ensure-mark)
421 (beginning-of-line arg))
424 (defun scroll-up-mark (&optional arg)
425 "Ensure mark is active; scroll upward ARG lines; or near full screen if no ARG.
426 A near full screen is `next-screen-context-lines' less than a full screen.
427 Negative ARG means scroll downward.
428 When calling from a program, supply a number as argument or nil."
429 (interactive "P")
430 (ensure-mark)
431 (cond (pc-select-override-scroll-error
432 (condition-case nil (scroll-up arg)
433 (end-of-buffer (goto-char (point-max)))))
434 (t (scroll-up arg))))
436 (defun beginning-of-buffer-mark (&optional arg)
437 "Ensure mark is active; move point to the beginning of the buffer.
438 With arg N, put point N/10 of the way from the beginning.
440 If the buffer is narrowed, this command uses the beginning and size
441 of the accessible part of the buffer.
443 Don't use this command in Lisp programs!
444 \(goto-char (p\oint-min)) is faster and avoids clobbering the mark."
445 (interactive "P")
446 (ensure-mark)
447 (let ((size (- (point-max) (point-min))))
448 (goto-char (if arg
449 (+ (point-min)
450 (if (> size 10000)
451 ;; Avoid overflow for large buffer sizes!
452 (* (prefix-numeric-value arg)
453 (/ size 10))
454 (/ (+ 10 (* size (prefix-numeric-value arg))) 10)))
455 (point-min))))
456 (if arg (forward-line 1)))
458 ;;;;;;;;
459 ;;; no mark
460 ;;;;;;;;
462 (defun backward-char-nomark (&optional arg)
463 "Deactivate mark; move point left ARG characters (right if ARG negative).
464 On attempt to pass beginning or end of buffer, stop and signal error."
465 (interactive "p")
466 (setq mark-active nil)
467 (backward-char arg))
469 (defun backward-word-nomark (&optional arg)
470 "Deactivate mark; move backward until encountering the end of a word.
471 With argument, do this that many times."
472 (interactive "p")
473 (setq mark-active nil)
474 (backward-word arg))
476 (defun backward-paragraph-nomark (&optional arg)
477 "Deactivate mark; move backward to start of paragraph.
478 With arg N, do it N times; negative arg -N means move forward N paragraphs.
480 A paragraph start is the beginning of a line which is a
481 `first-line-of-paragraph' or which is ordinary text and follows a
482 paragraph-separating line; except: if the first real line of a
483 paragraph is preceded by a blank line, the paragraph starts at that
484 blank line.
486 See `forward-paragraph' for more information."
487 (interactive "p")
488 (setq mark-active nil)
489 (backward-paragraph arg))
491 (defun previous-line-nomark (&optional arg)
492 "Deactivate mark; move cursor vertically up ARG lines.
493 If there is no character in the target line exactly over the current column,
494 the cursor is positioned after the character in that line which spans this
495 column, or at the end of the line if it is not long enough.
497 The command C-x C-n can be used to create
498 a semipermanent goal column to which this command always moves.
499 Then it does not try to move vertically."
500 (interactive "p")
501 (setq mark-active nil)
502 (previous-line arg)
503 (setq this-command 'previous-line))
505 (defun beginning-of-line-nomark (&optional arg)
506 "Deactivate mark; move point to beginning of current line.
507 With argument ARG not nil or 1, move forward ARG - 1 lines first.
508 If scan reaches end of buffer, stop there without error."
509 (interactive "p")
510 (setq mark-active nil)
511 (beginning-of-line arg))
513 (defun scroll-up-nomark (&optional arg)
514 "Deactivate mark; scroll upward ARG lines; or near full screen if no ARG.
515 A near full screen is `next-screen-context-lines' less than a full screen.
516 Negative ARG means scroll downward.
517 When calling from a program, supply a number as argument or nil."
518 (interactive "P")
519 (setq mark-active nil)
520 (cond (pc-select-override-scroll-error
521 (condition-case nil (scroll-up arg)
522 (end-of-buffer (goto-char (point-max)))))
523 (t (scroll-up arg))))
525 (defun beginning-of-buffer-nomark (&optional arg)
526 "Deactivate mark; move point to the beginning of the buffer.
527 With arg N, put point N/10 of the way from the beginning.
529 If the buffer is narrowed, this command uses the beginning and size
530 of the accessible part of the buffer.
532 Don't use this command in Lisp programs!
533 \(goto-char (point-min)) is faster and avoids clobbering the mark."
534 (interactive "P")
535 (setq mark-active nil)
536 (let ((size (- (point-max) (point-min))))
537 (goto-char (if arg
538 (+ (point-min)
539 (if (> size 10000)
540 ;; Avoid overflow for large buffer sizes!
541 (* (prefix-numeric-value arg)
542 (/ size 10))
543 (/ (+ 10 (* size (prefix-numeric-value arg))) 10)))
544 (point-min))))
545 (if arg (forward-line 1)))
547 ;;;###autoload
548 (defun pc-selection-mode ()
549 "Change mark behaviour to emulate Motif, MAC or MS-Windows cut and paste style.
551 This mode enables Delete Selection mode and Transient Mark mode.
553 The arrow keys (and others) are bound to new functions
554 which modify the status of the mark.
556 The ordinary arrow keys disable the mark.
557 The shift-arrow keys move, leaving the mark behind.
559 C-LEFT and C-RIGHT move back or forward one word, disabling the mark.
560 S-C-LEFT and S-C-RIGHT move back or forward one word, leaving the mark behind.
562 C-DOWN and C-UP move back or forward a paragraph, disabling the mark.
563 S-C-DOWN and S-C-UP move back or forward a paragraph, leaving the mark behind.
565 HOME moves to beginning of line, disabling the mark.
566 S-HOME moves to beginning of line, leaving the mark behind.
567 With Ctrl or Meta, these keys move to beginning of buffer instead.
569 END moves to end of line, disabling the mark.
570 S-END moves to end of line, leaving the mark behind.
571 With Ctrl or Meta, these keys move to end of buffer instead.
573 PRIOR or PAGE-UP scrolls and disables the mark.
574 S-PRIOR or S-PAGE-UP scrolls and leaves the mark behind.
576 S-DELETE kills the region (`kill-region').
577 S-INSERT yanks text from the kill ring (`yank').
578 C-INSERT copies the region into the kill ring (`copy-region-as-kill').
580 In addition, certain other PC bindings are imitated:
582 F6 other-window
583 DELETE delete-char
584 C-DELETE kill-line
585 M-DELETE kill-word
586 C-M-DELETE kill-sexp
587 C-BACKSPACE backward-kill-word
588 M-BACKSPACE undo"
590 (interactive)
592 ;; keybindings
595 ;; This is to avoid confusion with the delete-selection-mode
596 ;; On simple displays you can't see that a region is active and
597 ;; will be deleted on the next keypress. IMHO especially for
598 ;; copy-region-as-kill this is confusing
599 (define-key global-map "\M-w" 'copy-region-as-kill-nomark)
602 ;; The following keybindings are for standard ISO keyboards
603 ;; as they are used with IBM compatible PCs, IBM RS/6000,
604 ;; MACs, many X-Stations and probably more
605 (define-key global-map [S-right] 'forward-char-mark)
606 (define-key global-map [right] 'forward-char-nomark)
607 (define-key global-map [C-S-right] 'forward-word-mark)
608 (define-key global-map [C-right] 'forward-word-nomark)
609 (define-key global-map [M-S-right] 'forward-word-mark)
610 (define-key global-map [M-right] 'forward-word-nomark)
612 (define-key global-map [S-down] 'next-line-mark)
613 (define-key global-map [down] 'next-line-nomark)
615 (define-key global-map [S-end] 'end-of-line-mark)
616 (define-key global-map [end] 'end-of-line-nomark)
617 (global-set-key [S-C-end] 'end-of-buffer-mark)
618 (global-set-key [C-end] 'end-of-buffer-nomark)
619 (global-set-key [S-M-end] 'end-of-buffer-mark)
620 (global-set-key [M-end] 'end-of-buffer-nomark)
622 (define-key global-map [S-next] 'scroll-up-mark)
623 (define-key global-map [next] 'scroll-up-nomark)
625 (define-key global-map [S-left] 'backward-char-mark)
626 (define-key global-map [left] 'backward-char-nomark)
627 (define-key global-map [C-S-left] 'backward-word-mark)
628 (define-key global-map [C-left] 'backward-word-nomark)
629 (define-key global-map [M-S-left] 'backward-word-mark)
630 (define-key global-map [M-left] 'backward-word-nomark)
632 (define-key global-map [S-up] 'previous-line-mark)
633 (define-key global-map [up] 'previous-line-nomark)
635 (define-key global-map [S-home] 'beginning-of-line-mark)
636 (define-key global-map [home] 'beginning-of-line-nomark)
637 (global-set-key [S-C-home] 'beginning-of-buffer-mark)
638 (global-set-key [C-home] 'beginning-of-buffer-nomark)
639 (global-set-key [S-M-home] 'beginning-of-buffer-mark)
640 (global-set-key [M-home] 'beginning-of-buffer-nomark)
642 (define-key global-map [S-prior] 'scroll-down-mark)
643 (define-key global-map [prior] 'scroll-down-nomark)
645 (define-key global-map [S-insert] 'yank)
646 (define-key global-map [C-insert] 'copy-region-as-kill)
647 (define-key global-map [S-delete] 'kill-region)
649 (define-key global-map [M-S-down] 'forward-line-mark)
650 (define-key global-map [M-down] 'forward-line-nomark)
651 (define-key global-map [M-S-up] 'backward-line-mark)
652 (define-key global-map [M-up] 'backward-line-nomark)
654 ;; The following bindings are useful on Sun Type 3 keyboards
655 ;; They implement the Get-Delete-Put (copy-cut-paste)
656 ;; functions from sunview on the L6, L8 and L10 keys
657 (define-key global-map [f16] 'yank)
658 (define-key global-map [f18] 'copy-region-as-kill)
659 (define-key global-map [f20] 'kill-region)
661 ;; The following bindings are from Pete Forman.
662 ;; I modified them a little to work together with the
663 ;; mark functionality I added.
665 (global-set-key [f6] 'other-window) ; KNextPane F6
666 (global-set-key [delete] 'delete-char) ; KDelete Del
667 (global-set-key [C-delete] 'kill-line) ; KEraseEndLine cDel
668 (global-set-key [M-backspace] 'undo) ; KUndo aBS
669 (global-set-key [C-down] 'forward-paragraph-nomark) ; KNextPara cDn
670 (global-set-key [C-up] 'backward-paragraph-nomark) ; KPrevPara cUp
671 (global-set-key [S-C-down] 'forward-paragraph-mark)
672 (global-set-key [S-C-up] 'backward-paragraph-mark)
674 ;; The following bindings are taken from pc-mode.el
675 ;; as suggested by RMS.
676 ;; I only used the ones that are not covered above.
677 (define-key function-key-map [M-delete] [?\M-d])
678 (global-set-key [C-M-delete] 'kill-sexp)
679 (global-set-key [C-backspace] 'backward-kill-word)
680 (global-set-key [C-escape] 'list-buffers)
683 ;; setup
685 (setq transient-mark-mode t)
686 (setq mark-even-if-inactive t)
687 (delete-selection-mode 1)
689 ;;; pc-select.el ends here