Mercurial > emacs
annotate lisp/emulation/pc-select.el @ 14018:0a94cd2c51c4
Comment fixes.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Fri, 05 Jan 1996 00:45:43 +0000 |
parents | 23173d03180b |
children | 187735b53d52 |
rev | line source |
---|---|
13233 | 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 | |
4 | |
5 ;; Copyright (C) 1995 Free Software Foundation, Inc. | |
6 | |
7 ;; Author: Michael Staats <michael@thp.Uni-Duisburg.DE> | |
8 ;; Created: 26 Sep 1995 | |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
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. | |
16 | |
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. | |
21 | |
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 | |
24 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
25 | |
26 ;;; Commentary: | |
27 ;; | |
28 ;; This package emulates the mark, copy, cut and paste look-and-feel of motif | |
29 ;; programs (which is the same as the MAC gui and (sorry for that) MS-Windows). | |
30 ;; It modifies the keybindings of the cursor keys and the next, prior, | |
31 ;; home and end keys. They will modify mark-active. | |
32 ;; You can still get the old behaviour of cursor moving with the | |
33 ;; control sequences C-f, C-b, etc. | |
34 ;; This package uses transient-mark-mode and | |
35 ;; delete-selection-mode. | |
36 ;; | |
37 ;; In addition to that all key-bindings from the pc-mode are | |
38 ;; done here too (as suggested by RMS). | |
39 ;; | |
40 ;; As I found out after I finished the first version, s-region.el tries | |
41 ;; to do the same.... But my code is a little more complete and using | |
42 ;; delete-selection-mode is very important for the look-and-feel. | |
43 ;; Pete Forman <pete.forman@airgun.wg.waii.com> provided some motif | |
44 ;; compliant keybindings which I added. I had to modify them a little | |
45 ;; to add the -mark and -nomark functionality of cursor moving. | |
46 ;; | |
47 ;; Credits: | |
48 ;; Many thanks to all who made comments. | |
49 ;; Thanks to RMS and Ralf Muschall <prm@rz.uni-jena.de> for criticism. | |
50 ;; Kevin Cutts <cutts@ukraine.corp.mot.com> added the beginning-of-buffer | |
51 ;; and end-of-buffer functions which I modified a little. | |
52 ;; David Biesack <sasdjb@unx.sas.com> suggested some more cleanup. | |
53 ;; Thanks to Pete Forman <pete.forman@airgun.wg.waii.com> | |
54 ;; for additional motif keybindings. | |
55 ;; | |
56 ;; | |
57 ;; Ok, some details about the idea of pc-selection-mode: | |
58 ;; | |
59 ;; o The standard keys for moving around (right, left, up, down, home, end, | |
60 ;; prior, next, called "move-keys" from now on) will always de-activate | |
61 ;; the mark. | |
62 ;; o If you press "Shift" together with the "move-keys", the region | |
63 ;; you pass along is activated | |
64 ;; o You have the copy, cut and paste functions (as in many other programs) | |
65 ;; which will operate on the active region | |
66 ;; It was not possible to bind them to C-v, C-x and C-c for obvious | |
67 ;; emacs reasons. | |
68 ;; They will be bound according to the "old" behaviour to S-delete (cut), | |
69 ;; S-insert (paste) and C-insert (copy). These keys do the same in many | |
70 ;; other programs. | |
71 ;; | |
72 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
73 ;;;; | |
74 ;;;; INSTALLATION: | |
75 ;;;; o Put this file called "pc-select.el" into a path where emacs | |
76 ;;;; looks for lisp libraries. Byte-compile if you want to. | |
77 ;;;; o Put the command '(require 'pc-select) or | |
78 ;;;; '(load "pc-select")' into your ~/.emacs. After that line | |
79 ;;;; put the command '(pc-selection-mode)' to activate the mode. | |
80 ;;;; | |
81 ;;;; Please note that I am _not_ a lisp expert, I apologise for | |
82 ;;;; all hacks which look ugly to an experienced lisp programmer. | |
83 ;;;; Please report all errors and improvement. Thank you. | |
84 ;;;; | |
85 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
86 | |
87 ;;;; Code: | |
88 | |
89 ;;;; | |
90 ;; misc | |
91 ;;;; | |
92 | |
93 (provide 'pc-select) | |
94 | |
95 (defun copy-region-as-kill-nomark (beg end) | |
96 "Save the region as if killed; but don't kill it; deactivate mark. | |
97 If `interprogram-cut-function' is non-nil, also save the text for a window | |
98 system cut and paste.\n | |
99 Deactivating mark is to avoid confusion with delete-selection-mode | |
100 and transient-mark-mode." | |
101 (interactive "r") | |
102 (copy-region-as-kill beg end) | |
103 (setq mark-active nil) | |
104 (message "Region saved")) | |
105 | |
106 ;;;; | |
107 ;; non-interactive | |
108 ;;;; | |
109 (defun ensure-mark() | |
110 ;; make sure mark is active | |
111 ;; test if it is active, if it isn't, set it and activate it | |
112 (and (not mark-active) (set-mark-command nil))) | |
113 | |
114 ;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
115 ;;;;; forward and mark | |
116 ;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
117 | |
118 (defun forward-char-mark (&optional arg) | |
119 "Ensure mark is active; move point right ARG characters (left if ARG negative). | |
120 On reaching end of buffer, stop and signal error." | |
121 (interactive "p") | |
122 (ensure-mark) | |
123 (forward-char arg)) | |
124 | |
125 (defun forward-word-mark (&optional arg) | |
126 "Ensure mark is active; move point right ARG words (backward if ARG is negative). | |
127 Normally returns t. | |
128 If an edge of the buffer is reached, point is left there | |
129 and nil is returned." | |
130 (interactive "p") | |
131 (ensure-mark) | |
132 (forward-word arg)) | |
133 | |
134 (defun forward-paragraph-mark (&optional arg) | |
135 "Ensure mark is active; move forward to end of paragraph. | |
136 With arg N, do it N times; negative arg -N means move backward N paragraphs.\n | |
137 A line which `paragraph-start' matches either separates paragraphs | |
138 (if `paragraph-separate' matches it also) or is the first line of a paragraph. | |
139 A paragraph end is the beginning of a line which is not part of the paragraph | |
140 to which the end of the previous line belongs, or the end of the buffer." | |
141 (interactive "p") | |
142 (ensure-mark) | |
143 (forward-paragraph arg)) | |
144 | |
145 (defun next-line-mark (&optional arg) | |
146 "Ensure mark is active; move cursor vertically down ARG lines. | |
147 If there is no character in the target line exactly under the current column, | |
148 the cursor is positioned after the character in that line which spans this | |
149 column, or at the end of the line if it is not long enough. | |
150 If there is no line in the buffer after this one, behavior depends on the | |
151 value of `next-line-add-newlines'. If non-nil, it inserts a newline character | |
152 to create a line, and moves the cursor to that line. Otherwise it moves the | |
153 cursor to the end of the buffer \(if already at the end of the buffer, an error | |
154 is signaled).\n | |
155 The command C-x C-n can be used to create | |
156 a semipermanent goal column to which this command always moves. | |
157 Then it does not try to move vertically. This goal column is stored | |
158 in `goal-column', which is nil when there is none." | |
159 (interactive "p") | |
160 (ensure-mark) | |
161 (next-line arg)) | |
162 | |
163 (defun end-of-line-mark (&optional arg) | |
164 "Ensure mark is active; move point to end of current line. | |
165 With argument ARG not nil or 1, move forward ARG - 1 lines first. | |
166 If scan reaches end of buffer, stop there without error." | |
167 (interactive "p") | |
168 (ensure-mark) | |
169 (end-of-line arg)) | |
170 | |
171 (defun scroll-down-mark (&optional arg) | |
172 "Ensure mark is active; scroll down ARG lines; or near full screen if no ARG. | |
173 A near full screen is `next-screen-context-lines' less than a full screen. | |
174 Negative ARG means scroll upward. | |
175 When calling from a program, supply a number as argument or nil." | |
176 (interactive "P") | |
177 (ensure-mark) | |
178 (scroll-down arg)) | |
179 | |
180 (defun end-of-buffer-mark (&optional arg) | |
181 "Ensure mark is active; move point to the end of the buffer. | |
182 With arg N, put point N/10 of the way from the end.\n | |
183 If the buffer is narrowed, this command uses the beginning and size | |
184 of the accessible part of the buffer.\n | |
185 Don't use this command in Lisp programs! | |
186 \(goto-char \(point-max)) is faster and avoids clobbering the mark." | |
187 (interactive "P") | |
188 (ensure-mark) | |
189 (let ((size (- (point-max) (point-min)))) | |
190 (goto-char (if arg | |
191 (- (point-max) | |
192 (if (> size 10000) | |
193 ;; Avoid overflow for large buffer sizes! | |
194 (* (prefix-numeric-value arg) | |
195 (/ size 10)) | |
196 (/ (* size (prefix-numeric-value arg)) 10))) | |
197 (point-max)))) | |
198 ;; If we went to a place in the middle of the buffer, | |
199 ;; adjust it to the beginning of a line. | |
200 (if arg (forward-line 1) | |
201 ;; If the end of the buffer is not already on the screen, | |
202 ;; then scroll specially to put it near, but not at, the bottom. | |
203 (if (let ((old-point (point))) | |
204 (save-excursion | |
205 (goto-char (window-start)) | |
206 (vertical-motion (window-height)) | |
207 (< (point) old-point))) | |
208 (progn | |
209 (overlay-recenter (point)) | |
210 (recenter -3))))) | |
211 | |
212 ;;;;;;;;; | |
213 ;;;;; no mark | |
214 ;;;;;;;;; | |
215 | |
216 (defun forward-char-nomark (&optional arg) | |
217 "Deactivate mark; move point right ARG characters \(left if ARG negative). | |
218 On reaching end of buffer, stop and signal error." | |
219 (interactive "p") | |
220 (setq mark-active nil) | |
221 (forward-char arg)) | |
222 | |
223 (defun forward-word-nomark (&optional arg) | |
224 "Deactivate mark; move point right ARG words \(backward if ARG is negative). | |
225 Normally returns t. | |
226 If an edge of the buffer is reached, point is left there | |
227 and nil is returned." | |
228 (interactive "p") | |
229 (setq mark-active nil) | |
230 (forward-word arg)) | |
231 | |
232 (defun forward-paragraph-nomark (&optional arg) | |
233 "Deactivate mark; move forward to end of paragraph. | |
234 With arg N, do it N times; negative arg -N means move backward N paragraphs.\n | |
235 A line which `paragraph-start' matches either separates paragraphs | |
236 (if `paragraph-separate' matches it also) or is the first line of a paragraph. | |
237 A paragraph end is the beginning of a line which is not part of the paragraph | |
238 to which the end of the previous line belongs, or the end of the buffer." | |
239 (interactive "p") | |
240 (setq mark-active nil) | |
241 (forward-paragraph arg)) | |
242 | |
243 (defun next-line-nomark (&optional arg) | |
244 "Deactivate mark; move cursor vertically down ARG lines. | |
245 If there is no character in the target line exactly under the current column, | |
246 the cursor is positioned after the character in that line which spans this | |
247 column, or at the end of the line if it is not long enough. | |
248 If there is no line in the buffer after this one, behavior depends on the | |
249 value of `next-line-add-newlines'. If non-nil, it inserts a newline character | |
250 to create a line, and moves the cursor to that line. Otherwise it moves the | |
251 cursor to the end of the buffer (if already at the end of the buffer, an error | |
252 is signaled).\n | |
253 The command C-x C-n can be used to create | |
254 a semipermanent goal column to which this command always moves. | |
255 Then it does not try to move vertically. This goal column is stored | |
256 in `goal-column', which is nil when there is none." | |
257 (interactive "p") | |
258 (setq mark-active nil) | |
259 (next-line arg)) | |
260 | |
261 (defun end-of-line-nomark (&optional arg) | |
262 "Deactivate mark; move point to end of current line. | |
263 With argument ARG not nil or 1, move forward ARG - 1 lines first. | |
264 If scan reaches end of buffer, stop there without error." | |
265 (interactive "p") | |
266 (setq mark-active nil) | |
267 (end-of-line arg)) | |
268 | |
269 (defun scroll-down-nomark (&optional arg) | |
270 "Deactivate mark; scroll down ARG lines; or near full screen if no ARG. | |
271 A near full screen is `next-screen-context-lines' less than a full screen. | |
272 Negative ARG means scroll upward. | |
273 When calling from a program, supply a number as argument or nil." | |
274 (interactive "P") | |
275 (setq mark-active nil) | |
276 (scroll-down arg)) | |
277 | |
278 (defun end-of-buffer-nomark (&optional arg) | |
279 "Deactivate mark; move point to the end of the buffer. | |
280 With arg N, put point N/10 of the way from the end.\n | |
281 If the buffer is narrowed, this command uses the beginning and size | |
282 of the accessible part of the buffer.\n | |
283 Don't use this command in Lisp programs! | |
284 (goto-char (point-max)) is faster and avoids clobbering the mark." | |
285 (interactive "P") | |
286 (setq mark-active nil) | |
287 (let ((size (- (point-max) (point-min)))) | |
288 (goto-char (if arg | |
289 (- (point-max) | |
290 (if (> size 10000) | |
291 ;; Avoid overflow for large buffer sizes! | |
292 (* (prefix-numeric-value arg) | |
293 (/ size 10)) | |
294 (/ (* size (prefix-numeric-value arg)) 10))) | |
295 (point-max)))) | |
296 ;; If we went to a place in the middle of the buffer, | |
297 ;; adjust it to the beginning of a line. | |
298 (if arg (forward-line 1) | |
299 ;; If the end of the buffer is not already on the screen, | |
300 ;; then scroll specially to put it near, but not at, the bottom. | |
301 (if (let ((old-point (point))) | |
302 (save-excursion | |
303 (goto-char (window-start)) | |
304 (vertical-motion (window-height)) | |
305 (< (point) old-point))) | |
306 (progn | |
307 (overlay-recenter (point)) | |
308 (recenter -3))))) | |
309 | |
310 | |
311 ;;;;;;;;;;;;;;;;;;;; | |
312 ;;;;;; backwards and mark | |
313 ;;;;;;;;;;;;;;;;;;;; | |
314 | |
315 (defun backward-char-mark (&optional arg) | |
316 "Ensure mark is active; move point left ARG characters (right if ARG negative). | |
317 On attempt to pass beginning or end of buffer, stop and signal error." | |
318 (interactive "p") | |
319 (ensure-mark) | |
320 (backward-char arg)) | |
321 | |
322 (defun backward-word-mark (&optional arg) | |
323 "Ensure mark is active; move backward until encountering the end of a word. | |
324 With argument, do this that many times." | |
325 (interactive "p") | |
326 (ensure-mark) | |
327 (backward-word arg)) | |
328 | |
329 (defun backward-paragraph-mark (&optional arg) | |
330 "Ensure mark is active; move backward to start of paragraph. | |
331 With arg N, do it N times; negative arg -N means move forward N paragraphs.\n | |
332 A paragraph start is the beginning of a line which is a | |
333 `first-line-of-paragraph' or which is ordinary text and follows a | |
334 paragraph-separating line; except: if the first real line of a | |
335 paragraph is preceded by a blank line, the paragraph starts at that | |
336 blank line.\n | |
337 See `forward-paragraph' for more information." | |
338 (interactive "p") | |
339 (ensure-mark) | |
340 (backward-paragraph arg)) | |
341 | |
342 (defun previous-line-mark (&optional arg) | |
343 "Ensure mark is active; move cursor vertically up ARG lines. | |
344 If there is no character in the target line exactly over the current column, | |
345 the cursor is positioned after the character in that line which spans this | |
346 column, or at the end of the line if it is not long enough.\n | |
347 The command C-x C-n can be used to create | |
348 a semipermanent goal column to which this command always moves. | |
349 Then it does not try to move vertically.\n | |
350 If you are thinking of using this in a Lisp program, consider using | |
351 `forward-line' with a negative argument instead. It is usually easier | |
352 to use and more reliable (no dependence on goal column, etc.)." | |
353 (interactive "p") | |
354 (ensure-mark) | |
355 (previous-line arg)) | |
356 | |
357 (defun beginning-of-line-mark (&optional arg) | |
358 "Ensure mark is active; move point to beginning of current line. | |
359 With argument ARG not nil or 1, move forward ARG - 1 lines first. | |
360 If scan reaches end of buffer, stop there without error." | |
361 (interactive "p") | |
362 (ensure-mark) | |
363 (beginning-of-line arg)) | |
364 | |
365 | |
366 (defun scroll-up-mark (&optional arg) | |
367 "Ensure mark is active; scroll upward ARG lines; or near full screen if no ARG. | |
368 A near full screen is `next-screen-context-lines' less than a full screen. | |
369 Negative ARG means scroll downward. | |
370 When calling from a program, supply a number as argument or nil." | |
371 (interactive "P") | |
372 (ensure-mark) | |
373 (scroll-up arg)) | |
374 | |
375 (defun beginning-of-buffer-mark (&optional arg) | |
376 "Ensure mark is active; move point to the beginning of the buffer. | |
377 With arg N, put point N/10 of the way from the beginning.\n | |
378 If the buffer is narrowed, this command uses the beginning and size | |
379 of the accessible part of the buffer.\n | |
380 Don't use this command in Lisp programs! | |
381 \(goto-char (p\oint-min)) is faster and avoids clobbering the mark." | |
382 (interactive "P") | |
383 (ensure-mark) | |
384 (let ((size (- (point-max) (point-min)))) | |
385 (goto-char (if arg | |
386 (+ (point-min) | |
387 (if (> size 10000) | |
388 ;; Avoid overflow for large buffer sizes! | |
389 (* (prefix-numeric-value arg) | |
390 (/ size 10)) | |
391 (/ (+ 10 (* size (prefix-numeric-value arg))) 10))) | |
392 (point-min)))) | |
393 (if arg (forward-line 1))) | |
394 | |
395 ;;;;;;;; | |
396 ;;; no mark | |
397 ;;;;;;;; | |
398 | |
399 (defun backward-char-nomark (&optional arg) | |
400 "Deactivate mark; move point left ARG characters (right if ARG negative). | |
401 On attempt to pass beginning or end of buffer, stop and signal error." | |
402 (interactive "p") | |
403 (setq mark-active nil) | |
404 (backward-char arg)) | |
405 | |
406 (defun backward-word-nomark (&optional arg) | |
407 "Deactivate mark; move backward until encountering the end of a word. | |
408 With argument, do this that many times." | |
409 (interactive "p") | |
410 (setq mark-active nil) | |
411 (backward-word arg)) | |
412 | |
413 (defun backward-paragraph-nomark (&optional arg) | |
414 "Deactivate mark; move backward to start of paragraph. | |
415 With arg N, do it N times; negative arg -N means move forward N paragraphs.\n | |
416 A paragraph start is the beginning of a line which is a | |
417 `first-line-of-paragraph' or which is ordinary text and follows a | |
418 paragraph-separating line; except: if the first real line of a | |
419 paragraph is preceded by a blank line, the paragraph starts at that | |
420 blank line.\n | |
421 See `forward-paragraph' for more information." | |
422 (interactive "p") | |
423 (setq mark-active nil) | |
424 (backward-paragraph arg)) | |
425 | |
426 (defun previous-line-nomark (&optional arg) | |
427 "Deactivate mark; move cursor vertically up ARG lines. | |
428 If there is no character in the target line exactly over the current column, | |
429 the cursor is positioned after the character in that line which spans this | |
430 column, or at the end of the line if it is not long enough.\n | |
431 The command C-x C-n can be used to create | |
432 a semipermanent goal column to which this command always moves. | |
433 Then it does not try to move vertically." | |
434 (interactive "p") | |
435 (setq mark-active nil) | |
436 (previous-line arg)) | |
437 | |
438 (defun beginning-of-line-nomark (&optional arg) | |
439 "Deactivate mark; move point to beginning of current line. | |
440 With argument ARG not nil or 1, move forward ARG - 1 lines first. | |
441 If scan reaches end of buffer, stop there without error." | |
442 (interactive "p") | |
443 (setq mark-active nil) | |
444 (beginning-of-line arg)) | |
445 | |
446 (defun scroll-up-nomark (&optional arg) | |
447 "Deactivate mark; scroll upward ARG lines; or near full screen if no ARG. | |
448 A near full screen is `next-screen-context-lines' less than a full screen. | |
449 Negative ARG means scroll downward. | |
450 When calling from a program, supply a number as argument or nil." | |
451 (interactive "P") | |
452 (setq mark-active nil) | |
453 (scroll-up arg)) | |
454 | |
455 (defun beginning-of-buffer-nomark (&optional arg) | |
456 "Deactivate mark; move point to the beginning of the buffer. | |
457 With arg N, put point N/10 of the way from the beginning.\n | |
458 If the buffer is narrowed, this command uses the beginning and size | |
459 of the accessible part of the buffer.\n | |
460 Don't use this command in Lisp programs! | |
461 (goto-char (point-min)) is faster and avoids clobbering the mark." | |
462 (interactive "P") | |
463 (setq mark-active nil) | |
464 (let ((size (- (point-max) (point-min)))) | |
465 (goto-char (if arg | |
466 (+ (point-min) | |
467 (if (> size 10000) | |
468 ;; Avoid overflow for large buffer sizes! | |
469 (* (prefix-numeric-value arg) | |
470 (/ size 10)) | |
471 (/ (+ 10 (* size (prefix-numeric-value arg))) 10))) | |
472 (point-min)))) | |
473 (if arg (forward-line 1))) | |
474 | |
13234
e3b1df16f4b4
(pc-selection-mode): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
13233
diff
changeset
|
475 ;;;###autoload |
13233 | 476 (defun pc-selection-mode () |
477 "Change mark behaviour to emulate motif, MAC or MS-Windows cut and paste style.\n | |
478 This mode will switch on delete-selection-mode and | |
479 transient-mark-mode.\n | |
480 The cursor keys (and others) are bound to new functions | |
481 which will modify the status of the mark. It will be | |
482 possible to select regions with shift-cursorkeys. All this | |
483 tries to emulate the look-and-feel of GUIs like motif, | |
484 the MAC GUI or MS-Windows (sorry for the last one)." | |
485 (interactive) | |
486 ;; | |
487 ;; keybindings | |
488 ;; | |
489 | |
490 ;; This is to avoid confusion with the delete-selection-mode | |
491 ;; On simple displays you can't see that a region is active and | |
492 ;; will be deleted on the next keypress. IMHO especially for | |
493 ;; copy-region-as-kill this is confusing | |
494 (define-key global-map "\M-w" 'copy-region-as-kill-nomark) | |
495 | |
496 | |
497 ;; The followong keybindings are for standard ISO keyboards | |
498 ;; as they are used with IBM compatible PCs, IBM RS/6000, | |
499 ;; MACs, many X-Stations and probably more | |
500 (define-key global-map [S-right] 'forward-char-mark) | |
501 (define-key global-map [right] 'forward-char-nomark) | |
502 (define-key global-map [C-S-right] 'forward-word-mark) | |
503 (define-key global-map [C-right] 'forward-word-nomark) | |
504 | |
505 (define-key global-map [S-down] 'next-line-mark) | |
506 (define-key global-map [down] 'next-line-nomark) | |
507 | |
508 (define-key global-map [S-end] 'end-of-line-mark) | |
509 (define-key global-map [end] 'end-of-line-nomark) | |
510 (global-set-key [S-C-end] 'end-of-buffer-mark) | |
511 (global-set-key [C-end] 'end-of-buffer-nomark) | |
512 | |
513 (define-key global-map [S-next] 'scroll-up-mark) | |
514 (define-key global-map [next] 'scroll-up-nomark) | |
515 | |
516 (define-key global-map [S-left] 'backward-char-mark) | |
517 (define-key global-map [left] 'backward-char-nomark) | |
518 (define-key global-map [C-S-left] 'backward-word-mark) | |
519 (define-key global-map [C-left] 'backward-word-nomark) | |
520 | |
521 (define-key global-map [S-up] 'previous-line-mark) | |
522 (define-key global-map [up] 'previous-line-nomark) | |
523 | |
524 (define-key global-map [S-home] 'beginning-of-line-mark) | |
525 (define-key global-map [home] 'beginning-of-line-nomark) | |
526 (global-set-key [S-C-home] 'beginning-of-buffer-mark) | |
527 (global-set-key [C-home] 'beginning-of-buffer-nomark) | |
528 | |
529 (define-key global-map [S-prior] 'scroll-down-mark) | |
530 (define-key global-map [prior] 'scroll-down-nomark) | |
531 | |
532 (define-key global-map [S-insert] 'yank) | |
533 (define-key global-map [C-insert] 'copy-region-as-kill) | |
534 (define-key global-map [S-delete] 'kill-region) | |
535 | |
536 ;; The following bindings are usueful on Sun Type 3 keyboards | |
537 ;; They implement the Get-Delete-Put (copy-cut-paste) | |
538 ;; functions from sunview on the L6, L8 and L10 keys | |
539 (define-key global-map [f16] 'yank) | |
540 (define-key global-map [f18] 'copy-region-as-kill) | |
541 (define-key global-map [f20] 'kill-region) | |
542 | |
543 ;; The following bindings are from Pete Forman. | |
544 ;; I modified them a little to work together with the | |
545 ;; mark functionality I added. | |
546 | |
547 (global-set-key [f1] 'help) ; KHelp F1 | |
548 (global-set-key [f6] 'other-window) ; KNextPane F6 | |
549 (global-set-key [delete] 'delete-char) ; KDelete Del | |
550 (global-set-key [C-delete] 'kill-line) ; KEraseEndLine cDel | |
551 (global-set-key [M-backspace] 'undo) ; KUndo aBS | |
552 (global-set-key [C-down] 'forward-paragraph-nomark) ; KNextPara cDn | |
553 (global-set-key [C-up] 'backward-paragraph-nomark) ; KPrevPara cUp | |
554 (global-set-key [S-C-down] 'forward-paragraph-mark) | |
555 (global-set-key [S-C-up] 'backward-paragraph-mark) | |
556 | |
557 ;; The following bindings are taken from pc-mode.el | |
558 ;; as suggested by RMS. | |
559 ;; I only used the ones that are not covered above. | |
560 (define-key function-key-map [M-delete] [?\M-d]) | |
561 (global-set-key [C-M-delete] 'kill-sexp) | |
562 (global-set-key [C-backspace] 'backward-kill-word) | |
563 (global-set-key [C-escape] 'list-buffers) | |
564 | |
565 ;; | |
566 ;; setup | |
567 ;; | |
568 (setq transient-mark-mode t) | |
569 (setq mark-even-if-inactive t) | |
570 (delete-selection-mode 1)) | |
571 | |
572 ;;; pc-select.el ends here |