Mercurial > emacs
annotate lisp/emulation/pc-select.el @ 18135:000b0a8baf1a
(mail-setup): Don't set buffer-file-coding-system to nil.
Instead, kill the local binding of it.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 03 Jun 1997 08:17:35 +0000 |
parents | 3c572d848dab |
children | 75f7eec6d388 |
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 | |
14734 | 5 ;; Copyright (C) 1995, 1996 Free Software Foundation, Inc. |
13233 | 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 | |
14169 | 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. | |
13233 | 26 |
27 ;;; Commentary: | |
14169 | 28 |
13233 | 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. | |
37 ;; | |
38 ;; In addition to that all key-bindings from the pc-mode are | |
39 ;; done here too (as suggested by RMS). | |
40 ;; | |
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. | |
47 ;; | |
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. | |
14382 | 56 ;; Thanks to jvromans@squirrel.nl (Johan Vromans) for a bug report |
57 ;; concerning setting of this-command. | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
58 ;; Dan Nicolaescu <done@nexus.sorostm.ro> suggested suppressing the |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
59 ;; scroll-up/scroll-down error. |
13233 | 60 ;; |
61 ;; Ok, some details about the idea of pc-selection-mode: | |
62 ;; | |
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. | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
75 ;; |
13233 | 76 |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
77 ;;;; Customization: |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
78 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
79 (defvar pc-select-override-scroll-error t |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
80 "*Non-nil means don't generate error on scrolling past edge of buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
81 This variable applies in PC Selection mode only. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
82 The scroll commands normally generate an error if you try to scroll |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
83 past the top or bottom of the buffer. This is annoying when selecting |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
84 text with these commands. If you set this variable to non-nil, these |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
85 errors are suppressed.") |
13233 | 86 |
87 ;;;; | |
88 ;; misc | |
89 ;;;; | |
90 | |
91 (provide 'pc-select) | |
92 | |
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 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
96 system cut and paste. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
97 |
13233 | 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")) | |
104 | |
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 | |
15931
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
111 (or mark-active (set-mark-command nil))) |
13233 | 112 |
113 ;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
114 ;;;;; forward and mark | |
115 ;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
116 | |
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)) | |
123 | |
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)) | |
132 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
133 (defun forward-line-mark (&optional arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
134 "Ensure mark is active; move cursor vertically down ARG lines." |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
135 (interactive "p") |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
136 (ensure-mark) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
137 (forward-line arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
138 (setq this-command 'forward-line) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
139 ) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
140 |
13233 | 141 (defun forward-paragraph-mark (&optional arg) |
142 "Ensure mark is active; move forward to end of paragraph. | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
143 With arg N, do it N times; negative arg -N means move backward N paragraphs. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
144 |
13233 | 145 A line which `paragraph-start' matches either separates paragraphs |
14382 | 146 \(if `paragraph-separate' matches it also) or is the first line of a paragraph. |
13233 | 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)) | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
152 |
13233 | 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 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
162 is signaled). |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
163 |
13233 | 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) | |
14382 | 170 (next-line arg) |
171 (setq this-command 'next-line)) | |
13233 | 172 |
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) | |
14382 | 179 (end-of-line arg) |
180 (setq this-command 'end-of-line)) | |
13233 | 181 |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
182 (defun backward-line-mark (&optional arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
183 "Ensure mark is active; move cursor vertically up ARG lines." |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
184 (interactive "p") |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
185 (ensure-mark) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
186 (if (null arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
187 (setq arg 1)) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
188 (forward-line (- arg)) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
189 (setq this-command 'forward-line) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
190 ) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
191 |
13233 | 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) | |
15931
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
199 (cond (pc-select-override-scroll-error |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
200 (condition-case nil (scroll-down arg) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
201 (beginning-of-buffer (goto-char (point-min))))) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
202 (t (scroll-down arg)))) |
13233 | 203 |
204 (defun end-of-buffer-mark (&optional arg) | |
205 "Ensure mark is active; move point to the end of the buffer. | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
206 With arg N, put point N/10 of the way from the end. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
207 |
13233 | 208 If the buffer is narrowed, this command uses the beginning and size |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
209 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
210 |
13233 | 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))))) | |
237 | |
238 ;;;;;;;;; | |
239 ;;;;; no mark | |
240 ;;;;;;;;; | |
241 | |
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)) | |
248 | |
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)) | |
257 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
258 (defun forward-line-nomark (&optional arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
259 "Deactivate mark; move cursor vertically down ARG lines." |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
260 (interactive "p") |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
261 (setq mark-active nil) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
262 (forward-line arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
263 (setq this-command 'forward-line) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
264 ) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
265 |
13233 | 266 (defun forward-paragraph-nomark (&optional arg) |
267 "Deactivate mark; move forward to end of paragraph. | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
268 With arg N, do it N times; negative arg -N means move backward N paragraphs. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
269 |
13233 | 270 A line which `paragraph-start' matches either separates paragraphs |
14382 | 271 \(if `paragraph-separate' matches it also) or is the first line of a paragraph. |
13233 | 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)) | |
277 | |
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 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
287 is signaled). |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
288 |
13233 | 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) | |
14382 | 295 (next-line arg) |
296 (setq this-command 'next-line)) | |
13233 | 297 |
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) | |
14382 | 304 (end-of-line arg) |
305 (setq this-command 'end-of-line)) | |
13233 | 306 |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
307 (defun backward-line-nomark (&optional arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
308 "Deactivate mark; move cursor vertically up ARG lines." |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
309 (interactive "p") |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
310 (setq mark-active nil) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
311 (if (null arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
312 (setq arg 1)) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
313 (forward-line (- arg)) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
314 (setq this-command 'forward-line) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
315 ) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
316 |
13233 | 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) | |
15931
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
324 (cond (pc-select-override-scroll-error |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
325 (condition-case nil (scroll-down arg) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
326 (beginning-of-buffer (goto-char (point-min))))) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
327 (t (scroll-down arg)))) |
13233 | 328 |
329 (defun end-of-buffer-nomark (&optional arg) | |
330 "Deactivate mark; move point to the end of the buffer. | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
331 With arg N, put point N/10 of the way from the end. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
332 |
13233 | 333 If the buffer is narrowed, this command uses the beginning and size |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
334 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
335 |
13233 | 336 Don't use this command in Lisp programs! |
14382 | 337 \(goto-char (point-max)) is faster and avoids clobbering the mark." |
13233 | 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))))) | |
362 | |
363 | |
364 ;;;;;;;;;;;;;;;;;;;; | |
365 ;;;;;; backwards and mark | |
366 ;;;;;;;;;;;;;;;;;;;; | |
367 | |
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)) | |
374 | |
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)) | |
381 | |
382 (defun backward-paragraph-mark (&optional arg) | |
383 "Ensure mark is active; move backward to start of paragraph. | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
384 With arg N, do it N times; negative arg -N means move forward N paragraphs. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
385 |
13233 | 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 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
390 blank line. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
391 |
13233 | 392 See `forward-paragraph' for more information." |
393 (interactive "p") | |
394 (ensure-mark) | |
395 (backward-paragraph arg)) | |
396 | |
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 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
401 column, or at the end of the line if it is not long enough. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
402 |
13233 | 403 The command C-x C-n can be used to create |
404 a semipermanent goal column to which this command always moves. | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
405 Then it does not try to move vertically. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
406 |
13233 | 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) | |
14382 | 412 (previous-line arg) |
413 (setq this-command 'previous-line)) | |
13233 | 414 |
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)) | |
422 | |
423 | |
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) | |
15931
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
431 (cond (pc-select-override-scroll-error |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
432 (condition-case nil (scroll-up arg) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
433 (end-of-buffer (goto-char (point-max))))) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
434 (t (scroll-up arg)))) |
13233 | 435 |
436 (defun beginning-of-buffer-mark (&optional arg) | |
437 "Ensure mark is active; move point to the beginning of the buffer. | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
438 With arg N, put point N/10 of the way from the beginning. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
439 |
13233 | 440 If the buffer is narrowed, this command uses the beginning and size |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
441 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
442 |
13233 | 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))) | |
457 | |
458 ;;;;;;;; | |
459 ;;; no mark | |
460 ;;;;;;;; | |
461 | |
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)) | |
468 | |
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)) | |
475 | |
476 (defun backward-paragraph-nomark (&optional arg) | |
477 "Deactivate mark; move backward to start of paragraph. | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
478 With arg N, do it N times; negative arg -N means move forward N paragraphs. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
479 |
13233 | 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 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
484 blank line. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
485 |
13233 | 486 See `forward-paragraph' for more information." |
487 (interactive "p") | |
488 (setq mark-active nil) | |
489 (backward-paragraph arg)) | |
490 | |
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 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
495 column, or at the end of the line if it is not long enough. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
496 |
13233 | 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) | |
14382 | 502 (previous-line arg) |
503 (setq this-command 'previous-line)) | |
13233 | 504 |
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)) | |
512 | |
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) | |
15931
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
520 (cond (pc-select-override-scroll-error |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
521 (condition-case nil (scroll-up arg) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
522 (end-of-buffer (goto-char (point-max))))) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
523 (t (scroll-up arg)))) |
13233 | 524 |
525 (defun beginning-of-buffer-nomark (&optional arg) | |
526 "Deactivate mark; move point to the beginning of the buffer. | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
527 With arg N, put point N/10 of the way from the beginning. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
528 |
13233 | 529 If the buffer is narrowed, this command uses the beginning and size |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
530 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
531 |
13233 | 532 Don't use this command in Lisp programs! |
14382 | 533 \(goto-char (point-min)) is faster and avoids clobbering the mark." |
13233 | 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))) | |
546 | |
13234
e3b1df16f4b4
(pc-selection-mode): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
13233
diff
changeset
|
547 ;;;###autoload |
13233 | 548 (defun pc-selection-mode () |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
549 "Change mark behaviour to emulate Motif, MAC or MS-Windows cut and paste style. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
550 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
551 This mode enables Delete Selection mode and Transient Mark mode. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
552 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
553 The arrow keys (and others) are bound to new functions |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
554 which modify the status of the mark. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
555 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
556 The ordinary arrow keys disable the mark. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
557 The shift-arrow keys move, leaving the mark behind. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
558 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
559 C-LEFT and C-RIGHT move back or forward one word, disabling the mark. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
560 S-C-LEFT and S-C-RIGHT move back or forward one word, leaving the mark behind. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
561 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
562 C-DOWN and C-UP move back or forward a paragraph, disabling the mark. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
563 S-C-DOWN and S-C-UP move back or forward a paragraph, leaving the mark behind. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
564 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
565 HOME moves to beginning of line, disabling the mark. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
566 S-HOME moves to beginning of line, leaving the mark behind. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
567 With Ctrl or Meta, these keys move to beginning of buffer instead. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
568 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
569 END moves to end of line, disabling the mark. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
570 S-END moves to end of line, leaving the mark behind. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
571 With Ctrl or Meta, these keys move to end of buffer instead. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
572 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
573 PRIOR or PAGE-UP scrolls and disables the mark. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
574 S-PRIOR or S-PAGE-UP scrolls and leaves the mark behind. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
575 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
576 S-DELETE kills the region (`kill-region'). |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
577 S-INSERT yanks text from the kill ring (`yank'). |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
578 C-INSERT copies the region into the kill ring (`copy-region-as-kill'). |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
579 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
580 In addition, certain other PC bindings are imitated: |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
581 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
582 F6 other-window |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
583 DELETE delete-char |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
584 C-DELETE kill-line |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
585 M-DELETE kill-word |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
586 C-M-DELETE kill-sexp |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
587 C-BACKSPACE backward-kill-word |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
588 M-BACKSPACE undo" |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
589 |
13233 | 590 (interactive) |
591 ;; | |
592 ;; keybindings | |
593 ;; | |
594 | |
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) | |
600 | |
601 | |
14040 | 602 ;; The following keybindings are for standard ISO keyboards |
13233 | 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) | |
14382 | 609 (define-key global-map [M-S-right] 'forward-word-mark) |
610 (define-key global-map [M-right] 'forward-word-nomark) | |
13233 | 611 |
612 (define-key global-map [S-down] 'next-line-mark) | |
613 (define-key global-map [down] 'next-line-nomark) | |
614 | |
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) | |
14382 | 619 (global-set-key [S-M-end] 'end-of-buffer-mark) |
620 (global-set-key [M-end] 'end-of-buffer-nomark) | |
13233 | 621 |
622 (define-key global-map [S-next] 'scroll-up-mark) | |
623 (define-key global-map [next] 'scroll-up-nomark) | |
624 | |
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) | |
14382 | 629 (define-key global-map [M-S-left] 'backward-word-mark) |
630 (define-key global-map [M-left] 'backward-word-nomark) | |
13233 | 631 |
632 (define-key global-map [S-up] 'previous-line-mark) | |
633 (define-key global-map [up] 'previous-line-nomark) | |
634 | |
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) | |
14382 | 639 (global-set-key [S-M-home] 'beginning-of-buffer-mark) |
640 (global-set-key [M-home] 'beginning-of-buffer-nomark) | |
13233 | 641 |
642 (define-key global-map [S-prior] 'scroll-down-mark) | |
643 (define-key global-map [prior] 'scroll-down-nomark) | |
644 | |
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) | |
648 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
649 (define-key global-map [M-S-down] 'forward-line-mark) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
650 (define-key global-map [M-down] 'forward-line-nomark) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
651 (define-key global-map [M-S-up] 'backward-line-mark) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
652 (define-key global-map [M-up] 'backward-line-nomark) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
653 |
14040 | 654 ;; The following bindings are useful on Sun Type 3 keyboards |
13233 | 655 ;; They implement the Get-Delete-Put (copy-cut-paste) |
656 ;; functions from sunview on the L6, L8 and L10 keys | |
17915
3c572d848dab
(pc-selection-mode): Swap meanings of f16 and f18;
Richard M. Stallman <rms@gnu.org>
parents:
15931
diff
changeset
|
657 ;; Sam Steingold <sds@ptc.com> says that f16 is copy and f18 is paste. |
3c572d848dab
(pc-selection-mode): Swap meanings of f16 and f18;
Richard M. Stallman <rms@gnu.org>
parents:
15931
diff
changeset
|
658 (define-key global-map [f16] 'copy-region-as-kill) |
3c572d848dab
(pc-selection-mode): Swap meanings of f16 and f18;
Richard M. Stallman <rms@gnu.org>
parents:
15931
diff
changeset
|
659 (define-key global-map [f18] 'yank) |
13233 | 660 (define-key global-map [f20] 'kill-region) |
661 | |
662 ;; The following bindings are from Pete Forman. | |
663 ;; I modified them a little to work together with the | |
664 ;; mark functionality I added. | |
665 | |
666 (global-set-key [f6] 'other-window) ; KNextPane F6 | |
667 (global-set-key [delete] 'delete-char) ; KDelete Del | |
668 (global-set-key [C-delete] 'kill-line) ; KEraseEndLine cDel | |
669 (global-set-key [M-backspace] 'undo) ; KUndo aBS | |
670 (global-set-key [C-down] 'forward-paragraph-nomark) ; KNextPara cDn | |
671 (global-set-key [C-up] 'backward-paragraph-nomark) ; KPrevPara cUp | |
672 (global-set-key [S-C-down] 'forward-paragraph-mark) | |
673 (global-set-key [S-C-up] 'backward-paragraph-mark) | |
674 | |
675 ;; The following bindings are taken from pc-mode.el | |
676 ;; as suggested by RMS. | |
677 ;; I only used the ones that are not covered above. | |
678 (define-key function-key-map [M-delete] [?\M-d]) | |
679 (global-set-key [C-M-delete] 'kill-sexp) | |
680 (global-set-key [C-backspace] 'backward-kill-word) | |
681 (global-set-key [C-escape] 'list-buffers) | |
682 | |
683 ;; | |
684 ;; setup | |
685 ;; | |
686 (setq transient-mark-mode t) | |
687 (setq mark-even-if-inactive t) | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
688 (delete-selection-mode 1) |
15931
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
689 ) |
13233 | 690 ;;; pc-select.el ends here |