Mercurial > emacs
annotate lisp/emulation/pc-select.el @ 41675:30f353761d6c
*** empty log message ***
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 29 Nov 2001 12:13:52 +0000 |
parents | 77b08a460f84 |
children | 6134751ae11f |
rev | line source |
---|---|
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
1 ;;; pc-select.el --- emulate mark, cut, copy and paste from Motif |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
2 ;;; (or MAC GUI or MS-windoze (bah)) look-and-feel |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
3 ;;; including key bindings. |
13233 | 4 |
29807
e4668ff0692c
(pc-selection-mode): Bind `M-\d'
Gerd Moellmann <gerd@gnu.org>
parents:
22250
diff
changeset
|
5 ;; Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc. |
13233 | 6 |
7 ;; Author: Michael Staats <michael@thp.Uni-Duisburg.DE> | |
31566 | 8 ;; Keywords: convenience emulation |
13233 | 9 ;; Created: 26 Sep 1995 |
10 | |
11 ;; This file is part of GNU Emacs. | |
12 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
14 ;; it under the terms of the GNU General Public License as published by | |
15 ;; the Free Software Foundation; either version 2, or (at your option) | |
16 ;; any later version. | |
17 | |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
14169 | 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
26 ;; Boston, MA 02111-1307, USA. | |
13233 | 27 |
28 ;;; Commentary: | |
14169 | 29 |
13233 | 30 ;; This package emulates the mark, copy, cut and paste look-and-feel of motif |
31 ;; programs (which is the same as the MAC gui and (sorry for that) MS-Windows). | |
32 ;; It modifies the keybindings of the cursor keys and the next, prior, | |
33 ;; home and end keys. They will modify mark-active. | |
34 ;; You can still get the old behaviour of cursor moving with the | |
35 ;; control sequences C-f, C-b, etc. | |
36 ;; This package uses transient-mark-mode and | |
37 ;; delete-selection-mode. | |
38 ;; | |
30792 | 39 ;; In addition to that all key-bindings from the pc-mode are |
13233 | 40 ;; done here too (as suggested by RMS). |
41 ;; | |
42 ;; As I found out after I finished the first version, s-region.el tries | |
43 ;; to do the same.... But my code is a little more complete and using | |
44 ;; delete-selection-mode is very important for the look-and-feel. | |
45 ;; Pete Forman <pete.forman@airgun.wg.waii.com> provided some motif | |
46 ;; compliant keybindings which I added. I had to modify them a little | |
47 ;; to add the -mark and -nomark functionality of cursor moving. | |
48 ;; | |
49 ;; Credits: | |
50 ;; Many thanks to all who made comments. | |
51 ;; Thanks to RMS and Ralf Muschall <prm@rz.uni-jena.de> for criticism. | |
52 ;; Kevin Cutts <cutts@ukraine.corp.mot.com> added the beginning-of-buffer | |
53 ;; and end-of-buffer functions which I modified a little. | |
54 ;; David Biesack <sasdjb@unx.sas.com> suggested some more cleanup. | |
55 ;; Thanks to Pete Forman <pete.forman@airgun.wg.waii.com> | |
56 ;; for additional motif keybindings. | |
14382 | 57 ;; Thanks to jvromans@squirrel.nl (Johan Vromans) for a bug report |
58 ;; concerning setting of this-command. | |
19289 | 59 ;; Dan Nicolaescu <done@ece.arizona.ro> suggested suppressing the |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
60 ;; scroll-up/scroll-down error. |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
61 ;; Eli Barzilay (eli@cs.bgu.ac.il) suggested the sexps functions and |
30792 | 62 ;; keybindings. |
13233 | 63 ;; |
64 ;; Ok, some details about the idea of pc-selection-mode: | |
65 ;; | |
66 ;; o The standard keys for moving around (right, left, up, down, home, end, | |
67 ;; prior, next, called "move-keys" from now on) will always de-activate | |
68 ;; the mark. | |
69 ;; o If you press "Shift" together with the "move-keys", the region | |
70 ;; you pass along is activated | |
71 ;; o You have the copy, cut and paste functions (as in many other programs) | |
72 ;; which will operate on the active region | |
73 ;; It was not possible to bind them to C-v, C-x and C-c for obvious | |
74 ;; emacs reasons. | |
75 ;; They will be bound according to the "old" behaviour to S-delete (cut), | |
76 ;; S-insert (paste) and C-insert (copy). These keys do the same in many | |
77 ;; other programs. | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
78 ;; |
13233 | 79 |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37334
diff
changeset
|
80 ;;; Code: |
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37334
diff
changeset
|
81 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
82 ;; Customization: |
19289 | 83 (defgroup pc-select nil |
84 "Emulate pc bindings." | |
85 :prefix "pc-select" | |
22250
a77d473867b8
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
19289
diff
changeset
|
86 :group 'editing-basics |
a77d473867b8
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
19289
diff
changeset
|
87 :group 'convenience) |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
88 |
19289 | 89 (defcustom pc-select-override-scroll-error t |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
90 "*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
|
91 This variable applies in PC Selection mode only. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
92 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
|
93 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
|
94 text with these commands. If you set this variable to non-nil, these |
19289 | 95 errors are suppressed." |
96 :type 'boolean | |
97 :group 'pc-select) | |
13233 | 98 |
19289 | 99 (defcustom pc-select-selection-keys-only nil |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
100 "*Non-nil means only bind the basic selection keys when started. |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
101 Other keys that emulate pc-behavior will be untouched. |
19289 | 102 This gives mostly Emacs-like behaviour with only the selection keys enabled." |
103 :type 'boolean | |
104 :group 'pc-select) | |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
105 |
19289 | 106 (defcustom pc-select-meta-moves-sexps nil |
107 "*Non-nil means move sexp-wise with Meta key, otherwise move word-wise." | |
108 :type 'boolean | |
109 :group 'pc-select) | |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
110 |
13233 | 111 ;;;; |
112 ;; misc | |
113 ;;;; | |
114 | |
115 (provide 'pc-select) | |
116 | |
117 (defun copy-region-as-kill-nomark (beg end) | |
118 "Save the region as if killed; but don't kill it; deactivate mark. | |
119 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
|
120 system cut and paste. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
121 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
122 Deactivating mark is to avoid confusion with `delete-selection-mode' |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
123 and `transient-mark-mode'." |
13233 | 124 (interactive "r") |
125 (copy-region-as-kill beg end) | |
126 (setq mark-active nil) | |
127 (message "Region saved")) | |
128 | |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
129 (defun exchange-point-and-mark-nomark () |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
130 "Like `exchange-point-and-mark' but without activating the mark." |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
131 (interactive) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
132 (exchange-point-and-mark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
133 (setq mark-active nil)) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
134 |
13233 | 135 ;;;; |
136 ;; non-interactive | |
137 ;;;; | |
138 (defun ensure-mark() | |
139 ;; make sure mark is active | |
140 ;; 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
|
141 (or mark-active (set-mark-command nil))) |
13233 | 142 |
143 ;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
144 ;;;;; forward and mark | |
145 ;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
146 | |
147 (defun forward-char-mark (&optional arg) | |
148 "Ensure mark is active; move point right ARG characters (left if ARG negative). | |
149 On reaching end of buffer, stop and signal error." | |
150 (interactive "p") | |
151 (ensure-mark) | |
152 (forward-char arg)) | |
153 | |
154 (defun forward-word-mark (&optional arg) | |
155 "Ensure mark is active; move point right ARG words (backward if ARG is negative). | |
156 Normally returns t. | |
157 If an edge of the buffer is reached, point is left there | |
158 and nil is returned." | |
159 (interactive "p") | |
160 (ensure-mark) | |
161 (forward-word arg)) | |
162 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
163 (defun forward-line-mark (&optional arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
164 "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
|
165 (interactive "p") |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
166 (ensure-mark) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
167 (forward-line arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
168 (setq this-command 'forward-line) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
169 ) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
170 |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
171 (defun forward-sexp-mark (&optional arg) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
172 "Ensure mark is active; move forward across one balanced expression (sexp). |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
173 With argument, do it that many times. Negative arg -N means |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
174 move backward across N balanced expressions." |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
175 (interactive "p") |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
176 (ensure-mark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
177 (forward-sexp arg)) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
178 |
13233 | 179 (defun forward-paragraph-mark (&optional arg) |
180 "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
|
181 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
|
182 |
13233 | 183 A line which `paragraph-start' matches either separates paragraphs |
14382 | 184 \(if `paragraph-separate' matches it also) or is the first line of a paragraph. |
13233 | 185 A paragraph end is the beginning of a line which is not part of the paragraph |
186 to which the end of the previous line belongs, or the end of the buffer." | |
187 (interactive "p") | |
188 (ensure-mark) | |
189 (forward-paragraph arg)) | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
190 |
13233 | 191 (defun next-line-mark (&optional arg) |
192 "Ensure mark is active; move cursor vertically down ARG lines. | |
193 If there is no character in the target line exactly under the current column, | |
194 the cursor is positioned after the character in that line which spans this | |
195 column, or at the end of the line if it is not long enough. | |
196 If there is no line in the buffer after this one, behavior depends on the | |
197 value of `next-line-add-newlines'. If non-nil, it inserts a newline character | |
198 to create a line, and moves the cursor to that line. Otherwise it moves the | |
199 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
|
200 is signaled). |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
201 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
202 The command \\[set-goal-column] can be used to create |
13233 | 203 a semipermanent goal column to which this command always moves. |
204 Then it does not try to move vertically. This goal column is stored | |
205 in `goal-column', which is nil when there is none." | |
206 (interactive "p") | |
207 (ensure-mark) | |
14382 | 208 (next-line arg) |
209 (setq this-command 'next-line)) | |
13233 | 210 |
211 (defun end-of-line-mark (&optional arg) | |
212 "Ensure mark is active; move point to end of current line. | |
213 With argument ARG not nil or 1, move forward ARG - 1 lines first. | |
214 If scan reaches end of buffer, stop there without error." | |
215 (interactive "p") | |
216 (ensure-mark) | |
14382 | 217 (end-of-line arg) |
218 (setq this-command 'end-of-line)) | |
13233 | 219 |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
220 (defun backward-line-mark (&optional arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
221 "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
|
222 (interactive "p") |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
223 (ensure-mark) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
224 (if (null arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
225 (setq arg 1)) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
226 (forward-line (- arg)) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
227 (setq this-command 'forward-line) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
228 ) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
229 |
13233 | 230 (defun scroll-down-mark (&optional arg) |
231 "Ensure mark is active; scroll down ARG lines; or near full screen if no ARG. | |
232 A near full screen is `next-screen-context-lines' less than a full screen. | |
233 Negative ARG means scroll upward. | |
234 When calling from a program, supply a number as argument or nil." | |
30792 | 235 (interactive "P") |
13233 | 236 (ensure-mark) |
15931
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
237 (cond (pc-select-override-scroll-error |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
238 (condition-case nil (scroll-down arg) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
239 (beginning-of-buffer (goto-char (point-min))))) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
240 (t (scroll-down arg)))) |
13233 | 241 |
242 (defun end-of-buffer-mark (&optional arg) | |
243 "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
|
244 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
|
245 |
13233 | 246 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
|
247 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
248 |
13233 | 249 Don't use this command in Lisp programs! |
250 \(goto-char \(point-max)) is faster and avoids clobbering the mark." | |
251 (interactive "P") | |
252 (ensure-mark) | |
253 (let ((size (- (point-max) (point-min)))) | |
254 (goto-char (if arg | |
255 (- (point-max) | |
256 (if (> size 10000) | |
257 ;; Avoid overflow for large buffer sizes! | |
258 (* (prefix-numeric-value arg) | |
259 (/ size 10)) | |
260 (/ (* size (prefix-numeric-value arg)) 10))) | |
261 (point-max)))) | |
262 ;; If we went to a place in the middle of the buffer, | |
263 ;; adjust it to the beginning of a line. | |
264 (if arg (forward-line 1) | |
265 ;; If the end of the buffer is not already on the screen, | |
266 ;; then scroll specially to put it near, but not at, the bottom. | |
267 (if (let ((old-point (point))) | |
268 (save-excursion | |
269 (goto-char (window-start)) | |
270 (vertical-motion (window-height)) | |
271 (< (point) old-point))) | |
272 (progn | |
273 (overlay-recenter (point)) | |
274 (recenter -3))))) | |
275 | |
276 ;;;;;;;;; | |
277 ;;;;; no mark | |
278 ;;;;;;;;; | |
279 | |
280 (defun forward-char-nomark (&optional arg) | |
281 "Deactivate mark; move point right ARG characters \(left if ARG negative). | |
282 On reaching end of buffer, stop and signal error." | |
283 (interactive "p") | |
284 (setq mark-active nil) | |
285 (forward-char arg)) | |
286 | |
287 (defun forward-word-nomark (&optional arg) | |
288 "Deactivate mark; move point right ARG words \(backward if ARG is negative). | |
289 Normally returns t. | |
290 If an edge of the buffer is reached, point is left there | |
291 and nil is returned." | |
292 (interactive "p") | |
293 (setq mark-active nil) | |
294 (forward-word arg)) | |
295 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
296 (defun forward-line-nomark (&optional arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
297 "Deactivate mark; move cursor vertically down ARG lines." |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
298 (interactive "p") |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
299 (setq mark-active nil) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
300 (forward-line arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
301 (setq this-command 'forward-line) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
302 ) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
303 |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
304 (defun forward-sexp-nomark (&optional arg) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
305 "Deactivate mark; move forward across one balanced expression (sexp). |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
306 With argument, do it that many times. Negative arg -N means |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
307 move backward across N balanced expressions." |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
308 (interactive "p") |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
309 (setq mark-active nil) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
310 (forward-sexp arg)) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
311 |
13233 | 312 (defun forward-paragraph-nomark (&optional arg) |
313 "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
|
314 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
|
315 |
13233 | 316 A line which `paragraph-start' matches either separates paragraphs |
14382 | 317 \(if `paragraph-separate' matches it also) or is the first line of a paragraph. |
13233 | 318 A paragraph end is the beginning of a line which is not part of the paragraph |
319 to which the end of the previous line belongs, or the end of the buffer." | |
320 (interactive "p") | |
321 (setq mark-active nil) | |
322 (forward-paragraph arg)) | |
323 | |
324 (defun next-line-nomark (&optional arg) | |
325 "Deactivate mark; move cursor vertically down ARG lines. | |
326 If there is no character in the target line exactly under the current column, | |
327 the cursor is positioned after the character in that line which spans this | |
328 column, or at the end of the line if it is not long enough. | |
329 If there is no line in the buffer after this one, behavior depends on the | |
330 value of `next-line-add-newlines'. If non-nil, it inserts a newline character | |
331 to create a line, and moves the cursor to that line. Otherwise it moves the | |
332 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
|
333 is signaled). |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
334 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
335 The command \\[set-goal-column] can be used to create |
13233 | 336 a semipermanent goal column to which this command always moves. |
337 Then it does not try to move vertically. This goal column is stored | |
338 in `goal-column', which is nil when there is none." | |
339 (interactive "p") | |
340 (setq mark-active nil) | |
14382 | 341 (next-line arg) |
342 (setq this-command 'next-line)) | |
13233 | 343 |
344 (defun end-of-line-nomark (&optional arg) | |
345 "Deactivate mark; move point to end of current line. | |
346 With argument ARG not nil or 1, move forward ARG - 1 lines first. | |
347 If scan reaches end of buffer, stop there without error." | |
348 (interactive "p") | |
349 (setq mark-active nil) | |
14382 | 350 (end-of-line arg) |
351 (setq this-command 'end-of-line)) | |
13233 | 352 |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
353 (defun backward-line-nomark (&optional arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
354 "Deactivate mark; move cursor vertically up ARG lines." |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
355 (interactive "p") |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
356 (setq mark-active nil) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
357 (if (null arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
358 (setq arg 1)) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
359 (forward-line (- arg)) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
360 (setq this-command 'forward-line) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
361 ) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
362 |
13233 | 363 (defun scroll-down-nomark (&optional arg) |
364 "Deactivate mark; scroll down ARG lines; or near full screen if no ARG. | |
365 A near full screen is `next-screen-context-lines' less than a full screen. | |
366 Negative ARG means scroll upward. | |
367 When calling from a program, supply a number as argument or nil." | |
368 (interactive "P") | |
369 (setq mark-active nil) | |
15931
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
370 (cond (pc-select-override-scroll-error |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
371 (condition-case nil (scroll-down arg) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
372 (beginning-of-buffer (goto-char (point-min))))) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
373 (t (scroll-down arg)))) |
13233 | 374 |
375 (defun end-of-buffer-nomark (&optional arg) | |
376 "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
|
377 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
|
378 |
13233 | 379 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
|
380 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
381 |
13233 | 382 Don't use this command in Lisp programs! |
14382 | 383 \(goto-char (point-max)) is faster and avoids clobbering the mark." |
13233 | 384 (interactive "P") |
385 (setq mark-active nil) | |
386 (let ((size (- (point-max) (point-min)))) | |
387 (goto-char (if arg | |
388 (- (point-max) | |
389 (if (> size 10000) | |
390 ;; Avoid overflow for large buffer sizes! | |
391 (* (prefix-numeric-value arg) | |
392 (/ size 10)) | |
393 (/ (* size (prefix-numeric-value arg)) 10))) | |
394 (point-max)))) | |
395 ;; If we went to a place in the middle of the buffer, | |
396 ;; adjust it to the beginning of a line. | |
397 (if arg (forward-line 1) | |
398 ;; If the end of the buffer is not already on the screen, | |
399 ;; then scroll specially to put it near, but not at, the bottom. | |
400 (if (let ((old-point (point))) | |
401 (save-excursion | |
402 (goto-char (window-start)) | |
403 (vertical-motion (window-height)) | |
404 (< (point) old-point))) | |
405 (progn | |
406 (overlay-recenter (point)) | |
407 (recenter -3))))) | |
408 | |
409 | |
410 ;;;;;;;;;;;;;;;;;;;; | |
411 ;;;;;; backwards and mark | |
412 ;;;;;;;;;;;;;;;;;;;; | |
413 | |
414 (defun backward-char-mark (&optional arg) | |
415 "Ensure mark is active; move point left ARG characters (right if ARG negative). | |
416 On attempt to pass beginning or end of buffer, stop and signal error." | |
417 (interactive "p") | |
418 (ensure-mark) | |
419 (backward-char arg)) | |
420 | |
421 (defun backward-word-mark (&optional arg) | |
422 "Ensure mark is active; move backward until encountering the end of a word. | |
423 With argument, do this that many times." | |
424 (interactive "p") | |
425 (ensure-mark) | |
426 (backward-word arg)) | |
427 | |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
428 (defun backward-sexp-mark (&optional arg) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
429 "Ensure mark is active; move backward across one balanced expression (sexp). |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
430 With argument, do it that many times. Negative arg -N means |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
431 move forward across N balanced expressions." |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
432 (interactive "p") |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
433 (ensure-mark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
434 (backward-sexp arg)) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
435 |
13233 | 436 (defun backward-paragraph-mark (&optional arg) |
437 "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
|
438 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
|
439 |
13233 | 440 A paragraph start is the beginning of a line which is a |
441 `first-line-of-paragraph' or which is ordinary text and follows a | |
442 paragraph-separating line; except: if the first real line of a | |
443 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
|
444 blank line. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
445 |
13233 | 446 See `forward-paragraph' for more information." |
447 (interactive "p") | |
448 (ensure-mark) | |
449 (backward-paragraph arg)) | |
450 | |
451 (defun previous-line-mark (&optional arg) | |
452 "Ensure mark is active; move cursor vertically up ARG lines. | |
453 If there is no character in the target line exactly over the current column, | |
454 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
|
455 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
|
456 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
457 The command \\[set-goal-column] can be used to create |
13233 | 458 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
|
459 Then it does not try to move vertically. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
460 |
13233 | 461 If you are thinking of using this in a Lisp program, consider using |
462 `forward-line' with a negative argument instead. It is usually easier | |
463 to use and more reliable (no dependence on goal column, etc.)." | |
464 (interactive "p") | |
465 (ensure-mark) | |
14382 | 466 (previous-line arg) |
467 (setq this-command 'previous-line)) | |
13233 | 468 |
469 (defun beginning-of-line-mark (&optional arg) | |
470 "Ensure mark is active; move point to beginning of current line. | |
471 With argument ARG not nil or 1, move forward ARG - 1 lines first. | |
472 If scan reaches end of buffer, stop there without error." | |
473 (interactive "p") | |
474 (ensure-mark) | |
475 (beginning-of-line arg)) | |
476 | |
477 | |
478 (defun scroll-up-mark (&optional arg) | |
479 "Ensure mark is active; scroll upward ARG lines; or near full screen if no ARG. | |
480 A near full screen is `next-screen-context-lines' less than a full screen. | |
481 Negative ARG means scroll downward. | |
482 When calling from a program, supply a number as argument or nil." | |
483 (interactive "P") | |
484 (ensure-mark) | |
15931
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
485 (cond (pc-select-override-scroll-error |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
486 (condition-case nil (scroll-up arg) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
487 (end-of-buffer (goto-char (point-max))))) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
488 (t (scroll-up arg)))) |
13233 | 489 |
490 (defun beginning-of-buffer-mark (&optional arg) | |
491 "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
|
492 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
|
493 |
13233 | 494 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
|
495 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
496 |
13233 | 497 Don't use this command in Lisp programs! |
498 \(goto-char (p\oint-min)) is faster and avoids clobbering the mark." | |
499 (interactive "P") | |
30792 | 500 (ensure-mark) |
13233 | 501 (let ((size (- (point-max) (point-min)))) |
502 (goto-char (if arg | |
503 (+ (point-min) | |
504 (if (> size 10000) | |
505 ;; Avoid overflow for large buffer sizes! | |
506 (* (prefix-numeric-value arg) | |
507 (/ size 10)) | |
508 (/ (+ 10 (* size (prefix-numeric-value arg))) 10))) | |
509 (point-min)))) | |
510 (if arg (forward-line 1))) | |
511 | |
512 ;;;;;;;; | |
513 ;;; no mark | |
514 ;;;;;;;; | |
515 | |
516 (defun backward-char-nomark (&optional arg) | |
517 "Deactivate mark; move point left ARG characters (right if ARG negative). | |
518 On attempt to pass beginning or end of buffer, stop and signal error." | |
519 (interactive "p") | |
520 (setq mark-active nil) | |
521 (backward-char arg)) | |
522 | |
523 (defun backward-word-nomark (&optional arg) | |
524 "Deactivate mark; move backward until encountering the end of a word. | |
525 With argument, do this that many times." | |
526 (interactive "p") | |
527 (setq mark-active nil) | |
528 (backward-word arg)) | |
529 | |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
530 (defun backward-sexp-nomark (&optional arg) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
531 "Deactivate mark; move backward across one balanced expression (sexp). |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
532 With argument, do it that many times. Negative arg -N means |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
533 move forward across N balanced expressions." |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
534 (interactive "p") |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
535 (setq mark-active nil) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
536 (backward-sexp arg)) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
537 |
13233 | 538 (defun backward-paragraph-nomark (&optional arg) |
539 "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
|
540 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
|
541 |
13233 | 542 A paragraph start is the beginning of a line which is a |
543 `first-line-of-paragraph' or which is ordinary text and follows a | |
544 paragraph-separating line; except: if the first real line of a | |
545 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
|
546 blank line. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
547 |
13233 | 548 See `forward-paragraph' for more information." |
549 (interactive "p") | |
550 (setq mark-active nil) | |
551 (backward-paragraph arg)) | |
552 | |
553 (defun previous-line-nomark (&optional arg) | |
554 "Deactivate mark; move cursor vertically up ARG lines. | |
555 If there is no character in the target line exactly over the current column, | |
556 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
|
557 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
|
558 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
559 The command \\[set-goal-column] can be used to create |
13233 | 560 a semipermanent goal column to which this command always moves. |
561 Then it does not try to move vertically." | |
562 (interactive "p") | |
563 (setq mark-active nil) | |
14382 | 564 (previous-line arg) |
565 (setq this-command 'previous-line)) | |
13233 | 566 |
567 (defun beginning-of-line-nomark (&optional arg) | |
568 "Deactivate mark; move point to beginning of current line. | |
569 With argument ARG not nil or 1, move forward ARG - 1 lines first. | |
570 If scan reaches end of buffer, stop there without error." | |
571 (interactive "p") | |
572 (setq mark-active nil) | |
573 (beginning-of-line arg)) | |
574 | |
575 (defun scroll-up-nomark (&optional arg) | |
576 "Deactivate mark; scroll upward ARG lines; or near full screen if no ARG. | |
577 A near full screen is `next-screen-context-lines' less than a full screen. | |
578 Negative ARG means scroll downward. | |
579 When calling from a program, supply a number as argument or nil." | |
580 (interactive "P") | |
581 (setq mark-active nil) | |
15931
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
582 (cond (pc-select-override-scroll-error |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
583 (condition-case nil (scroll-up arg) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
584 (end-of-buffer (goto-char (point-max))))) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
585 (t (scroll-up arg)))) |
13233 | 586 |
587 (defun beginning-of-buffer-nomark (&optional arg) | |
588 "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
|
589 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
|
590 |
13233 | 591 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
|
592 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
593 |
13233 | 594 Don't use this command in Lisp programs! |
14382 | 595 \(goto-char (point-min)) is faster and avoids clobbering the mark." |
13233 | 596 (interactive "P") |
597 (setq mark-active nil) | |
598 (let ((size (- (point-max) (point-min)))) | |
599 (goto-char (if arg | |
600 (+ (point-min) | |
601 (if (> size 10000) | |
602 ;; Avoid overflow for large buffer sizes! | |
603 (* (prefix-numeric-value arg) | |
604 (/ size 10)) | |
605 (/ (+ 10 (* size (prefix-numeric-value arg))) 10))) | |
606 (point-min)))) | |
607 (if arg (forward-line 1))) | |
608 | |
13234
e3b1df16f4b4
(pc-selection-mode): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
13233
diff
changeset
|
609 ;;;###autoload |
13233 | 610 (defun pc-selection-mode () |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
611 "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
|
612 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
613 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
|
614 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
615 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
|
616 which modify the status of the mark. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
617 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
618 The ordinary arrow keys disable the mark. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
619 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
|
620 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
621 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
|
622 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
|
623 |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
624 M-LEFT and M-RIGHT move back or forward one word or sexp, disabling the mark. |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
625 S-M-LEFT and S-M-RIGHT move back or forward one word or sexp, leaving the mark |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
626 behind. To control whether these keys move word-wise or sexp-wise set the |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
627 variable `pc-select-meta-moves-sexps' after loading pc-select.el but before |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
628 turning `pc-selection-mode' on. |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
629 |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
630 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
|
631 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
|
632 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
633 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
|
634 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
|
635 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
|
636 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
637 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
|
638 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
|
639 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
|
640 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
641 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
|
642 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
|
643 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
644 S-DELETE kills the region (`kill-region'). |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
645 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
|
646 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
|
647 |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
648 In addition, certain other PC bindings are imitated (to avoid this, set |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
649 the variable `pc-select-selection-keys-only' to t after loading pc-select.el |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
650 but before calling `pc-selection-mode'): |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
651 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
652 F6 `other-window' |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
653 DELETE `delete-char' |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
654 C-DELETE `kill-line' |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
655 M-DELETE `kill-word' |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
656 C-M-DELETE `kill-sexp' |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
657 C-BACKSPACE `backward-kill-word' |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
658 M-BACKSPACE `undo'" |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
659 ;; FIXME: make into a proper minor mode (i.e. undoable). |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
660 ;; FIXME: bring pc-bindings-mode here ? |
13233 | 661 (interactive) |
662 ;; | |
663 ;; keybindings | |
664 ;; | |
665 | |
666 ;; This is to avoid confusion with the delete-selection-mode | |
667 ;; On simple displays you can't see that a region is active and | |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
668 ;; will be deleted on the next keypress. IMHO especially for |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
669 ;; copy-region-as-kill this is confusing. |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
670 ;; The same goes for exchange-point-and-mark |
30792 | 671 (define-key global-map "\M-w" 'copy-region-as-kill-nomark) |
672 (define-key global-map "\C-x\C-x" 'exchange-point-and-mark-nomark) | |
14040 | 673 ;; The following keybindings are for standard ISO keyboards |
13233 | 674 ;; as they are used with IBM compatible PCs, IBM RS/6000, |
675 ;; MACs, many X-Stations and probably more | |
676 (define-key global-map [S-right] 'forward-char-mark) | |
677 (define-key global-map [right] 'forward-char-nomark) | |
678 (define-key global-map [C-S-right] 'forward-word-mark) | |
679 (define-key global-map [C-right] 'forward-word-nomark) | |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
680 (define-key global-map [S-left] 'backward-char-mark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
681 (define-key global-map [left] 'backward-char-nomark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
682 (define-key global-map [C-S-left] 'backward-word-mark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
683 (define-key global-map [C-left] 'backward-word-nomark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
684 (cond (pc-select-meta-moves-sexps |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
685 (define-key global-map [M-S-right] 'forward-sexp-mark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
686 (define-key global-map [M-right] 'forward-sexp-nomark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
687 (define-key global-map [M-S-left] 'backward-sexp-mark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
688 (define-key global-map [M-left] 'backward-sexp-nomark)) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
689 (t |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
690 (define-key global-map [M-S-right] 'forward-word-mark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
691 (define-key global-map [M-right] 'forward-word-nomark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
692 (define-key global-map [M-S-left] 'backward-word-mark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
693 (define-key global-map [M-left] 'backward-word-nomark))) |
13233 | 694 |
695 (define-key global-map [S-down] 'next-line-mark) | |
696 (define-key global-map [down] 'next-line-nomark) | |
697 | |
698 (define-key global-map [S-end] 'end-of-line-mark) | |
699 (define-key global-map [end] 'end-of-line-nomark) | |
700 (global-set-key [S-C-end] 'end-of-buffer-mark) | |
701 (global-set-key [C-end] 'end-of-buffer-nomark) | |
14382 | 702 (global-set-key [S-M-end] 'end-of-buffer-mark) |
703 (global-set-key [M-end] 'end-of-buffer-nomark) | |
13233 | 704 |
705 (define-key global-map [S-next] 'scroll-up-mark) | |
706 (define-key global-map [next] 'scroll-up-nomark) | |
707 | |
708 (define-key global-map [S-up] 'previous-line-mark) | |
709 (define-key global-map [up] 'previous-line-nomark) | |
710 | |
711 (define-key global-map [S-home] 'beginning-of-line-mark) | |
712 (define-key global-map [home] 'beginning-of-line-nomark) | |
713 (global-set-key [S-C-home] 'beginning-of-buffer-mark) | |
714 (global-set-key [C-home] 'beginning-of-buffer-nomark) | |
14382 | 715 (global-set-key [S-M-home] 'beginning-of-buffer-mark) |
716 (global-set-key [M-home] 'beginning-of-buffer-nomark) | |
13233 | 717 |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
718 (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
|
719 (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
|
720 (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
|
721 (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
|
722 |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
723 (define-key global-map [S-prior] 'scroll-down-mark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
724 (define-key global-map [prior] 'scroll-down-nomark) |
13233 | 725 |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
726 ;; Next four lines are from Pete Forman. |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
727 (global-set-key [C-down] 'forward-paragraph-nomark) ; KNextPara cDn |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
728 (global-set-key [C-up] 'backward-paragraph-nomark) ; KPrevPara cUp |
13233 | 729 (global-set-key [S-C-down] 'forward-paragraph-mark) |
30792 | 730 (global-set-key [S-C-up] 'backward-paragraph-mark) |
13233 | 731 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
732 (unless pc-select-selection-keys-only |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
733 ;; We are behaving like normal-erase-is-backspace-mode, so |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
734 ;; say so explicitly. But don't do that on a Unix tty, since |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
735 ;; some of them have keyboards that by default already behave |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
736 ;; as if normal-erase-is-backspace mode is on, and turning it |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
737 ;; a second time screws them up. |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
738 (if (or (eq window-system 'x) |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
739 (memq system-name '(ms-dos windows-nt macos))) |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
740 (progn |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
741 (setq-default normal-erase-is-backspace t) |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
742 (normal-erase-is-backspace-mode 1)) |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
743 ;; This is for tty. We don't turn on normal-erase-is-backspace, |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
744 ;; but bind keys as pc-selection-mode did before |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
745 ;; normal-erase-is-backspace was invented, to keep us back |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
746 ;; compatible. |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
747 (global-set-key [delete] 'delete-char) ; KDelete Del |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
748 (define-key function-key-map [M-delete] [?\M-d]) |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
749 (global-set-key [C-backspace] 'backward-kill-word)) |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
750 (define-key global-map [S-insert] 'yank) |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
751 (define-key global-map [C-insert] 'copy-region-as-kill) |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
752 (define-key global-map [S-delete] 'kill-region) |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
753 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
754 ;; The following bindings are useful on Sun Type 3 keyboards |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
755 ;; They implement the Get-Delete-Put (copy-cut-paste) |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
756 ;; functions from sunview on the L6, L8 and L10 keys |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
757 ;; Sam Steingold <sds@gnu.org> says that f16 is copy and f18 is paste. |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
758 (define-key global-map [f16] 'copy-region-as-kill) |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
759 (define-key global-map [f18] 'yank) |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
760 (define-key global-map [f20] 'kill-region) |
13233 | 761 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
762 ;; The following bindings are from Pete Forman. |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
763 (global-set-key [f6] 'other-window) ; KNextPane F6 |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
764 (global-set-key [C-delete] 'kill-line) ; KEraseEndLine cDel |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
765 (global-set-key "\M-\d" 'undo) ; KUndo aBS |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
766 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
767 ;; The following binding is taken from pc-mode.el |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
768 ;; as suggested by RMS. |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
769 ;; I only used the one that is not covered above. |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
770 (global-set-key [C-M-delete] 'kill-sexp) |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
771 ;; Next line proposed by Eli Barzilay |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
772 (global-set-key [C-escape] 'electric-buffer-list)) |
30792 | 773 ;; |
13233 | 774 ;; setup |
775 ;; | |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
776 ;; Next line proposed by Eli Barzilay |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
777 (setq highlight-nonselected-windows nil) |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
778 (transient-mark-mode 1) |
13233 | 779 (setq mark-even-if-inactive t) |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
780 (delete-selection-mode 1)) |
19289 | 781 |
782 ;;;###autoload | |
783 (defcustom pc-selection-mode nil | |
784 "Toggle PC Selection mode. | |
785 Change mark behaviour to emulate Motif, MAC or MS-Windows cut and paste style, | |
786 and cursor movement commands. | |
787 This mode enables Delete Selection mode and Transient Mark mode. | |
788 You must modify via \\[customize] for this variable to have an effect." | |
789 :set (lambda (symbol value) | |
790 (if value (pc-selection-mode))) | |
791 :type 'boolean | |
792 :group 'pc-select | |
793 :require 'pc-select) | |
794 | |
13233 | 795 ;;; pc-select.el ends here |