Mercurial > emacs
annotate lisp/emulation/pc-select.el @ 15907:c25492075289
Replace \n in doc strings.
(pc-selection-mode): Big doc fix. Don't bind f1.
(forward-line-mark): New function.
(forward-line-nomark): New function.
(backward-line-mark): New function.
(backward-line-nomark): New function.
(pc-selection-mode): Add keybindings for those functions.
(pc-select-override-scroll-error): New variable.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 24 Aug 1996 16:10:28 +0000 |
parents | 20f4c4a078b2 |
children | c729af982039 |
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 | |
111 (and (not mark-active) (set-mark-command nil))) | |
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) | |
199 (scroll-down arg)) | |
200 | |
201 (defun end-of-buffer-mark (&optional arg) | |
202 "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
|
203 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
|
204 |
13233 | 205 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
|
206 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
207 |
13233 | 208 Don't use this command in Lisp programs! |
209 \(goto-char \(point-max)) is faster and avoids clobbering the mark." | |
210 (interactive "P") | |
211 (ensure-mark) | |
212 (let ((size (- (point-max) (point-min)))) | |
213 (goto-char (if arg | |
214 (- (point-max) | |
215 (if (> size 10000) | |
216 ;; Avoid overflow for large buffer sizes! | |
217 (* (prefix-numeric-value arg) | |
218 (/ size 10)) | |
219 (/ (* size (prefix-numeric-value arg)) 10))) | |
220 (point-max)))) | |
221 ;; If we went to a place in the middle of the buffer, | |
222 ;; adjust it to the beginning of a line. | |
223 (if arg (forward-line 1) | |
224 ;; If the end of the buffer is not already on the screen, | |
225 ;; then scroll specially to put it near, but not at, the bottom. | |
226 (if (let ((old-point (point))) | |
227 (save-excursion | |
228 (goto-char (window-start)) | |
229 (vertical-motion (window-height)) | |
230 (< (point) old-point))) | |
231 (progn | |
232 (overlay-recenter (point)) | |
233 (recenter -3))))) | |
234 | |
235 ;;;;;;;;; | |
236 ;;;;; no mark | |
237 ;;;;;;;;; | |
238 | |
239 (defun forward-char-nomark (&optional arg) | |
240 "Deactivate mark; move point right ARG characters \(left if ARG negative). | |
241 On reaching end of buffer, stop and signal error." | |
242 (interactive "p") | |
243 (setq mark-active nil) | |
244 (forward-char arg)) | |
245 | |
246 (defun forward-word-nomark (&optional arg) | |
247 "Deactivate mark; move point right ARG words \(backward if ARG is negative). | |
248 Normally returns t. | |
249 If an edge of the buffer is reached, point is left there | |
250 and nil is returned." | |
251 (interactive "p") | |
252 (setq mark-active nil) | |
253 (forward-word arg)) | |
254 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
255 (defun forward-line-nomark (&optional arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
256 "Deactivate mark; move cursor vertically down ARG lines." |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
257 (interactive "p") |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
258 (setq mark-active nil) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
259 (forward-line arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
260 (setq this-command 'forward-line) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
261 ) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
262 |
13233 | 263 (defun forward-paragraph-nomark (&optional arg) |
264 "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
|
265 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
|
266 |
13233 | 267 A line which `paragraph-start' matches either separates paragraphs |
14382 | 268 \(if `paragraph-separate' matches it also) or is the first line of a paragraph. |
13233 | 269 A paragraph end is the beginning of a line which is not part of the paragraph |
270 to which the end of the previous line belongs, or the end of the buffer." | |
271 (interactive "p") | |
272 (setq mark-active nil) | |
273 (forward-paragraph arg)) | |
274 | |
275 (defun next-line-nomark (&optional arg) | |
276 "Deactivate mark; move cursor vertically down ARG lines. | |
277 If there is no character in the target line exactly under the current column, | |
278 the cursor is positioned after the character in that line which spans this | |
279 column, or at the end of the line if it is not long enough. | |
280 If there is no line in the buffer after this one, behavior depends on the | |
281 value of `next-line-add-newlines'. If non-nil, it inserts a newline character | |
282 to create a line, and moves the cursor to that line. Otherwise it moves the | |
283 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
|
284 is signaled). |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
285 |
13233 | 286 The command C-x C-n can be used to create |
287 a semipermanent goal column to which this command always moves. | |
288 Then it does not try to move vertically. This goal column is stored | |
289 in `goal-column', which is nil when there is none." | |
290 (interactive "p") | |
291 (setq mark-active nil) | |
14382 | 292 (next-line arg) |
293 (setq this-command 'next-line)) | |
13233 | 294 |
295 (defun end-of-line-nomark (&optional arg) | |
296 "Deactivate mark; move point to end of current line. | |
297 With argument ARG not nil or 1, move forward ARG - 1 lines first. | |
298 If scan reaches end of buffer, stop there without error." | |
299 (interactive "p") | |
300 (setq mark-active nil) | |
14382 | 301 (end-of-line arg) |
302 (setq this-command 'end-of-line)) | |
13233 | 303 |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
304 (defun backward-line-nomark (&optional arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
305 "Deactivate mark; move cursor vertically up ARG lines." |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
306 (interactive "p") |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
307 (setq mark-active nil) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
308 (if (null arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
309 (setq arg 1)) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
310 (forward-line (- arg)) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
311 (setq this-command 'forward-line) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
312 ) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
313 |
13233 | 314 (defun scroll-down-nomark (&optional arg) |
315 "Deactivate mark; scroll down ARG lines; or near full screen if no ARG. | |
316 A near full screen is `next-screen-context-lines' less than a full screen. | |
317 Negative ARG means scroll upward. | |
318 When calling from a program, supply a number as argument or nil." | |
319 (interactive "P") | |
320 (setq mark-active nil) | |
321 (scroll-down arg)) | |
322 | |
323 (defun end-of-buffer-nomark (&optional arg) | |
324 "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
|
325 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
|
326 |
13233 | 327 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
|
328 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
329 |
13233 | 330 Don't use this command in Lisp programs! |
14382 | 331 \(goto-char (point-max)) is faster and avoids clobbering the mark." |
13233 | 332 (interactive "P") |
333 (setq mark-active nil) | |
334 (let ((size (- (point-max) (point-min)))) | |
335 (goto-char (if arg | |
336 (- (point-max) | |
337 (if (> size 10000) | |
338 ;; Avoid overflow for large buffer sizes! | |
339 (* (prefix-numeric-value arg) | |
340 (/ size 10)) | |
341 (/ (* size (prefix-numeric-value arg)) 10))) | |
342 (point-max)))) | |
343 ;; If we went to a place in the middle of the buffer, | |
344 ;; adjust it to the beginning of a line. | |
345 (if arg (forward-line 1) | |
346 ;; If the end of the buffer is not already on the screen, | |
347 ;; then scroll specially to put it near, but not at, the bottom. | |
348 (if (let ((old-point (point))) | |
349 (save-excursion | |
350 (goto-char (window-start)) | |
351 (vertical-motion (window-height)) | |
352 (< (point) old-point))) | |
353 (progn | |
354 (overlay-recenter (point)) | |
355 (recenter -3))))) | |
356 | |
357 | |
358 ;;;;;;;;;;;;;;;;;;;; | |
359 ;;;;;; backwards and mark | |
360 ;;;;;;;;;;;;;;;;;;;; | |
361 | |
362 (defun backward-char-mark (&optional arg) | |
363 "Ensure mark is active; move point left ARG characters (right if ARG negative). | |
364 On attempt to pass beginning or end of buffer, stop and signal error." | |
365 (interactive "p") | |
366 (ensure-mark) | |
367 (backward-char arg)) | |
368 | |
369 (defun backward-word-mark (&optional arg) | |
370 "Ensure mark is active; move backward until encountering the end of a word. | |
371 With argument, do this that many times." | |
372 (interactive "p") | |
373 (ensure-mark) | |
374 (backward-word arg)) | |
375 | |
376 (defun backward-paragraph-mark (&optional arg) | |
377 "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
|
378 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
|
379 |
13233 | 380 A paragraph start is the beginning of a line which is a |
381 `first-line-of-paragraph' or which is ordinary text and follows a | |
382 paragraph-separating line; except: if the first real line of a | |
383 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
|
384 blank line. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
385 |
13233 | 386 See `forward-paragraph' for more information." |
387 (interactive "p") | |
388 (ensure-mark) | |
389 (backward-paragraph arg)) | |
390 | |
391 (defun previous-line-mark (&optional arg) | |
392 "Ensure mark is active; move cursor vertically up ARG lines. | |
393 If there is no character in the target line exactly over the current column, | |
394 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
|
395 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
|
396 |
13233 | 397 The command C-x C-n can be used to create |
398 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
|
399 Then it does not try to move vertically. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
400 |
13233 | 401 If you are thinking of using this in a Lisp program, consider using |
402 `forward-line' with a negative argument instead. It is usually easier | |
403 to use and more reliable (no dependence on goal column, etc.)." | |
404 (interactive "p") | |
405 (ensure-mark) | |
14382 | 406 (previous-line arg) |
407 (setq this-command 'previous-line)) | |
13233 | 408 |
409 (defun beginning-of-line-mark (&optional arg) | |
410 "Ensure mark is active; move point to beginning of current line. | |
411 With argument ARG not nil or 1, move forward ARG - 1 lines first. | |
412 If scan reaches end of buffer, stop there without error." | |
413 (interactive "p") | |
414 (ensure-mark) | |
415 (beginning-of-line arg)) | |
416 | |
417 | |
418 (defun scroll-up-mark (&optional arg) | |
419 "Ensure mark is active; scroll upward ARG lines; or near full screen if no ARG. | |
420 A near full screen is `next-screen-context-lines' less than a full screen. | |
421 Negative ARG means scroll downward. | |
422 When calling from a program, supply a number as argument or nil." | |
423 (interactive "P") | |
424 (ensure-mark) | |
425 (scroll-up arg)) | |
426 | |
427 (defun beginning-of-buffer-mark (&optional arg) | |
428 "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
|
429 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
|
430 |
13233 | 431 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
|
432 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
433 |
13233 | 434 Don't use this command in Lisp programs! |
435 \(goto-char (p\oint-min)) is faster and avoids clobbering the mark." | |
436 (interactive "P") | |
437 (ensure-mark) | |
438 (let ((size (- (point-max) (point-min)))) | |
439 (goto-char (if arg | |
440 (+ (point-min) | |
441 (if (> size 10000) | |
442 ;; Avoid overflow for large buffer sizes! | |
443 (* (prefix-numeric-value arg) | |
444 (/ size 10)) | |
445 (/ (+ 10 (* size (prefix-numeric-value arg))) 10))) | |
446 (point-min)))) | |
447 (if arg (forward-line 1))) | |
448 | |
449 ;;;;;;;; | |
450 ;;; no mark | |
451 ;;;;;;;; | |
452 | |
453 (defun backward-char-nomark (&optional arg) | |
454 "Deactivate mark; move point left ARG characters (right if ARG negative). | |
455 On attempt to pass beginning or end of buffer, stop and signal error." | |
456 (interactive "p") | |
457 (setq mark-active nil) | |
458 (backward-char arg)) | |
459 | |
460 (defun backward-word-nomark (&optional arg) | |
461 "Deactivate mark; move backward until encountering the end of a word. | |
462 With argument, do this that many times." | |
463 (interactive "p") | |
464 (setq mark-active nil) | |
465 (backward-word arg)) | |
466 | |
467 (defun backward-paragraph-nomark (&optional arg) | |
468 "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
|
469 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
|
470 |
13233 | 471 A paragraph start is the beginning of a line which is a |
472 `first-line-of-paragraph' or which is ordinary text and follows a | |
473 paragraph-separating line; except: if the first real line of a | |
474 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
|
475 blank line. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
476 |
13233 | 477 See `forward-paragraph' for more information." |
478 (interactive "p") | |
479 (setq mark-active nil) | |
480 (backward-paragraph arg)) | |
481 | |
482 (defun previous-line-nomark (&optional arg) | |
483 "Deactivate mark; move cursor vertically up ARG lines. | |
484 If there is no character in the target line exactly over the current column, | |
485 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
|
486 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
|
487 |
13233 | 488 The command C-x C-n can be used to create |
489 a semipermanent goal column to which this command always moves. | |
490 Then it does not try to move vertically." | |
491 (interactive "p") | |
492 (setq mark-active nil) | |
14382 | 493 (previous-line arg) |
494 (setq this-command 'previous-line)) | |
13233 | 495 |
496 (defun beginning-of-line-nomark (&optional arg) | |
497 "Deactivate mark; move point to beginning of current line. | |
498 With argument ARG not nil or 1, move forward ARG - 1 lines first. | |
499 If scan reaches end of buffer, stop there without error." | |
500 (interactive "p") | |
501 (setq mark-active nil) | |
502 (beginning-of-line arg)) | |
503 | |
504 (defun scroll-up-nomark (&optional arg) | |
505 "Deactivate mark; scroll upward ARG lines; or near full screen if no ARG. | |
506 A near full screen is `next-screen-context-lines' less than a full screen. | |
507 Negative ARG means scroll downward. | |
508 When calling from a program, supply a number as argument or nil." | |
509 (interactive "P") | |
510 (setq mark-active nil) | |
511 (scroll-up arg)) | |
512 | |
513 (defun beginning-of-buffer-nomark (&optional arg) | |
514 "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
|
515 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
|
516 |
13233 | 517 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
|
518 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
519 |
13233 | 520 Don't use this command in Lisp programs! |
14382 | 521 \(goto-char (point-min)) is faster and avoids clobbering the mark." |
13233 | 522 (interactive "P") |
523 (setq mark-active nil) | |
524 (let ((size (- (point-max) (point-min)))) | |
525 (goto-char (if arg | |
526 (+ (point-min) | |
527 (if (> size 10000) | |
528 ;; Avoid overflow for large buffer sizes! | |
529 (* (prefix-numeric-value arg) | |
530 (/ size 10)) | |
531 (/ (+ 10 (* size (prefix-numeric-value arg))) 10))) | |
532 (point-min)))) | |
533 (if arg (forward-line 1))) | |
534 | |
13234
e3b1df16f4b4
(pc-selection-mode): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
13233
diff
changeset
|
535 ;;;###autoload |
13233 | 536 (defun pc-selection-mode () |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
537 "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
|
538 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
539 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
|
540 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
541 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
|
542 which modify the status of the mark. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
543 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
544 The ordinary arrow keys disable the mark. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
545 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
|
546 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
547 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
|
548 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
|
549 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
550 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
|
551 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
|
552 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
553 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
|
554 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
|
555 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
|
556 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
557 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
|
558 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
|
559 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
|
560 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
561 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
|
562 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
|
563 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
564 S-DELETE kills the region (`kill-region'). |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
565 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
|
566 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
|
567 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
568 In addition, certain other PC bindings are imitated: |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
569 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
570 F6 other-window |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
571 DELETE delete-char |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
572 C-DELETE kill-line |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
573 M-DELETE kill-word |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
574 C-M-DELETE kill-sexp |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
575 C-BACKSPACE backward-kill-word |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
576 M-BACKSPACE undo" |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
577 |
13233 | 578 (interactive) |
579 ;; | |
580 ;; keybindings | |
581 ;; | |
582 | |
583 ;; This is to avoid confusion with the delete-selection-mode | |
584 ;; On simple displays you can't see that a region is active and | |
585 ;; will be deleted on the next keypress. IMHO especially for | |
586 ;; copy-region-as-kill this is confusing | |
587 (define-key global-map "\M-w" 'copy-region-as-kill-nomark) | |
588 | |
589 | |
14040 | 590 ;; The following keybindings are for standard ISO keyboards |
13233 | 591 ;; as they are used with IBM compatible PCs, IBM RS/6000, |
592 ;; MACs, many X-Stations and probably more | |
593 (define-key global-map [S-right] 'forward-char-mark) | |
594 (define-key global-map [right] 'forward-char-nomark) | |
595 (define-key global-map [C-S-right] 'forward-word-mark) | |
596 (define-key global-map [C-right] 'forward-word-nomark) | |
14382 | 597 (define-key global-map [M-S-right] 'forward-word-mark) |
598 (define-key global-map [M-right] 'forward-word-nomark) | |
13233 | 599 |
600 (define-key global-map [S-down] 'next-line-mark) | |
601 (define-key global-map [down] 'next-line-nomark) | |
602 | |
603 (define-key global-map [S-end] 'end-of-line-mark) | |
604 (define-key global-map [end] 'end-of-line-nomark) | |
605 (global-set-key [S-C-end] 'end-of-buffer-mark) | |
606 (global-set-key [C-end] 'end-of-buffer-nomark) | |
14382 | 607 (global-set-key [S-M-end] 'end-of-buffer-mark) |
608 (global-set-key [M-end] 'end-of-buffer-nomark) | |
13233 | 609 |
610 (define-key global-map [S-next] 'scroll-up-mark) | |
611 (define-key global-map [next] 'scroll-up-nomark) | |
612 | |
613 (define-key global-map [S-left] 'backward-char-mark) | |
614 (define-key global-map [left] 'backward-char-nomark) | |
615 (define-key global-map [C-S-left] 'backward-word-mark) | |
616 (define-key global-map [C-left] 'backward-word-nomark) | |
14382 | 617 (define-key global-map [M-S-left] 'backward-word-mark) |
618 (define-key global-map [M-left] 'backward-word-nomark) | |
13233 | 619 |
620 (define-key global-map [S-up] 'previous-line-mark) | |
621 (define-key global-map [up] 'previous-line-nomark) | |
622 | |
623 (define-key global-map [S-home] 'beginning-of-line-mark) | |
624 (define-key global-map [home] 'beginning-of-line-nomark) | |
625 (global-set-key [S-C-home] 'beginning-of-buffer-mark) | |
626 (global-set-key [C-home] 'beginning-of-buffer-nomark) | |
14382 | 627 (global-set-key [S-M-home] 'beginning-of-buffer-mark) |
628 (global-set-key [M-home] 'beginning-of-buffer-nomark) | |
13233 | 629 |
630 (define-key global-map [S-prior] 'scroll-down-mark) | |
631 (define-key global-map [prior] 'scroll-down-nomark) | |
632 | |
633 (define-key global-map [S-insert] 'yank) | |
634 (define-key global-map [C-insert] 'copy-region-as-kill) | |
635 (define-key global-map [S-delete] 'kill-region) | |
636 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
637 (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
|
638 (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
|
639 (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
|
640 (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
|
641 |
14040 | 642 ;; The following bindings are useful on Sun Type 3 keyboards |
13233 | 643 ;; They implement the Get-Delete-Put (copy-cut-paste) |
644 ;; functions from sunview on the L6, L8 and L10 keys | |
645 (define-key global-map [f16] 'yank) | |
646 (define-key global-map [f18] 'copy-region-as-kill) | |
647 (define-key global-map [f20] 'kill-region) | |
648 | |
649 ;; The following bindings are from Pete Forman. | |
650 ;; I modified them a little to work together with the | |
651 ;; mark functionality I added. | |
652 | |
653 (global-set-key [f6] 'other-window) ; KNextPane F6 | |
654 (global-set-key [delete] 'delete-char) ; KDelete Del | |
655 (global-set-key [C-delete] 'kill-line) ; KEraseEndLine cDel | |
656 (global-set-key [M-backspace] 'undo) ; KUndo aBS | |
657 (global-set-key [C-down] 'forward-paragraph-nomark) ; KNextPara cDn | |
658 (global-set-key [C-up] 'backward-paragraph-nomark) ; KPrevPara cUp | |
659 (global-set-key [S-C-down] 'forward-paragraph-mark) | |
660 (global-set-key [S-C-up] 'backward-paragraph-mark) | |
661 | |
662 ;; The following bindings are taken from pc-mode.el | |
663 ;; as suggested by RMS. | |
664 ;; I only used the ones that are not covered above. | |
665 (define-key function-key-map [M-delete] [?\M-d]) | |
666 (global-set-key [C-M-delete] 'kill-sexp) | |
667 (global-set-key [C-backspace] 'backward-kill-word) | |
668 (global-set-key [C-escape] 'list-buffers) | |
669 | |
670 ;; | |
671 ;; setup | |
672 ;; | |
673 (setq transient-mark-mode t) | |
674 (setq mark-even-if-inactive t) | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
675 (delete-selection-mode 1) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
676 (cond (pc-select-override-scroll-error |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
677 (defadvice scroll-up (around scroll-to-bottom-if-eob activate) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
678 (condition-case nil |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
679 ad-do-it |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
680 (end-of-buffer (goto-char (point-max))))) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
681 (defadvice scroll-down (around scroll-to-top-if-bob activate) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
682 (condition-case nil |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
683 ad-do-it |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
684 (beginning-of-buffer (goto-char (point-min)))))))) |
13233 | 685 |
686 ;;; pc-select.el ends here |