Mercurial > emacs
annotate lisp/emulation/pc-select.el @ 86155:39b88001b04b
(pc-select-shifted-mark): New var.
(ensure-mark): Set it.
(maybe-deactivate-mark): New fun.
Use it everywhere instead of (setq mark-active nil)
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 16 Nov 2007 17:58:30 +0000 |
parents | a55a536ce0db |
children | a54bf760b43d |
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 |
64701
34bd8e434dd7
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
5 ;; Copyright (C) 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004, |
75346 | 6 ;; 2005, 2006, 2007 Free Software Foundation, Inc. |
13233 | 7 |
8 ;; Author: Michael Staats <michael@thp.Uni-Duisburg.DE> | |
31566 | 9 ;; Keywords: convenience emulation |
13233 | 10 ;; Created: 26 Sep 1995 |
11 | |
12 ;; This file is part of GNU Emacs. | |
13 | |
14 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
15 ;; it under the terms of the GNU General Public License as published by | |
78218
ac0efac52065
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75346
diff
changeset
|
16 ;; the Free Software Foundation; either version 3, or (at your option) |
13233 | 17 ;; any later version. |
18 | |
19 ;; GNU Emacs is distributed in the hope that it will be useful, | |
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 ;; GNU General Public License for more details. | |
23 | |
24 ;; You should have received a copy of the GNU General Public License | |
14169 | 25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
27 ;; Boston, MA 02110-1301, USA. | |
13233 | 28 |
29 ;;; Commentary: | |
14169 | 30 |
13233 | 31 ;; This package emulates the mark, copy, cut and paste look-and-feel of motif |
32 ;; programs (which is the same as the MAC gui and (sorry for that) MS-Windows). | |
33 ;; It modifies the keybindings of the cursor keys and the next, prior, | |
34 ;; home and end keys. They will modify mark-active. | |
35 ;; You can still get the old behaviour of cursor moving with the | |
36 ;; control sequences C-f, C-b, etc. | |
37 ;; This package uses transient-mark-mode and | |
38 ;; delete-selection-mode. | |
39 ;; | |
30792 | 40 ;; In addition to that all key-bindings from the pc-mode are |
13233 | 41 ;; done here too (as suggested by RMS). |
42 ;; | |
43 ;; As I found out after I finished the first version, s-region.el tries | |
44 ;; to do the same.... But my code is a little more complete and using | |
45 ;; delete-selection-mode is very important for the look-and-feel. | |
46 ;; Pete Forman <pete.forman@airgun.wg.waii.com> provided some motif | |
47 ;; compliant keybindings which I added. I had to modify them a little | |
48 ;; to add the -mark and -nomark functionality of cursor moving. | |
49 ;; | |
50 ;; Credits: | |
51 ;; Many thanks to all who made comments. | |
52 ;; Thanks to RMS and Ralf Muschall <prm@rz.uni-jena.de> for criticism. | |
53 ;; Kevin Cutts <cutts@ukraine.corp.mot.com> added the beginning-of-buffer | |
54 ;; and end-of-buffer functions which I modified a little. | |
55 ;; David Biesack <sasdjb@unx.sas.com> suggested some more cleanup. | |
56 ;; Thanks to Pete Forman <pete.forman@airgun.wg.waii.com> | |
57 ;; for additional motif keybindings. | |
14382 | 58 ;; Thanks to jvromans@squirrel.nl (Johan Vromans) for a bug report |
59 ;; concerning setting of this-command. | |
19289 | 60 ;; 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
|
61 ;; scroll-up/scroll-down error. |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
62 ;; Eli Barzilay (eli@cs.bgu.ac.il) suggested the sexps functions and |
30792 | 63 ;; keybindings. |
13233 | 64 ;; |
56083
d62a2b6e582e
Doc fixes: say "PC Selection mode", not "`pc-selection-mode'".
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
65 ;; Ok, some details about the idea of PC Selection mode: |
13233 | 66 ;; |
67 ;; o The standard keys for moving around (right, left, up, down, home, end, | |
68 ;; prior, next, called "move-keys" from now on) will always de-activate | |
69 ;; the mark. | |
70 ;; o If you press "Shift" together with the "move-keys", the region | |
71 ;; you pass along is activated | |
72 ;; o You have the copy, cut and paste functions (as in many other programs) | |
73 ;; which will operate on the active region | |
74 ;; It was not possible to bind them to C-v, C-x and C-c for obvious | |
75 ;; emacs reasons. | |
76 ;; They will be bound according to the "old" behaviour to S-delete (cut), | |
77 ;; S-insert (paste) and C-insert (copy). These keys do the same in many | |
78 ;; other programs. | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
79 ;; |
13233 | 80 |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37334
diff
changeset
|
81 ;;; Code: |
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37334
diff
changeset
|
82 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
83 ;; Customization: |
19289 | 84 (defgroup pc-select nil |
85 "Emulate pc bindings." | |
86 :prefix "pc-select" | |
22250
a77d473867b8
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
19289
diff
changeset
|
87 :group 'editing-basics |
a77d473867b8
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
19289
diff
changeset
|
88 :group 'convenience) |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
89 |
19289 | 90 (defcustom pc-select-override-scroll-error t |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
91 "*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
|
92 This variable applies in PC Selection mode only. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
93 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
|
94 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
|
95 text with these commands. If you set this variable to non-nil, these |
19289 | 96 errors are suppressed." |
97 :type 'boolean | |
98 :group 'pc-select) | |
13233 | 99 |
19289 | 100 (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
|
101 "*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
|
102 Other keys that emulate pc-behavior will be untouched. |
63266
0a2deeba6710
(pc-select-selection-keys-only, pc-selection-mode): Fix spellings in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
62440
diff
changeset
|
103 This gives mostly Emacs-like behavior with only the selection keys enabled." |
19289 | 104 :type 'boolean |
105 :group 'pc-select) | |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
106 |
19289 | 107 (defcustom pc-select-meta-moves-sexps nil |
108 "*Non-nil means move sexp-wise with Meta key, otherwise move word-wise." | |
109 :type 'boolean | |
110 :group 'pc-select) | |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
111 |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
112 (defcustom pc-selection-mode-hook nil |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
113 "The hook to run when pc-selection-mode is toggled." |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
114 :type 'hook |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
115 :group 'pc-select) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
116 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
117 (defvar pc-select-saved-settings-alist nil |
56083
d62a2b6e582e
Doc fixes: say "PC Selection mode", not "`pc-selection-mode'".
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
118 "The values of the variables before PC Selection mode was toggled on. |
d62a2b6e582e
Doc fixes: say "PC Selection mode", not "`pc-selection-mode'".
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
119 When PC Selection mode is toggled on, it sets quite a few variables |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
120 for its own purposes. This alist holds the original values of the |
56083
d62a2b6e582e
Doc fixes: say "PC Selection mode", not "`pc-selection-mode'".
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
121 variables PC Selection mode had set, so that these variables can be |
d62a2b6e582e
Doc fixes: say "PC Selection mode", not "`pc-selection-mode'".
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
122 restored to their original values when PC Selection mode is toggled off.") |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
123 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
124 (defvar pc-select-map nil |
56083
d62a2b6e582e
Doc fixes: say "PC Selection mode", not "`pc-selection-mode'".
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
125 "The keymap used as the global map when PC Selection mode is on." ) |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
126 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
127 (defvar pc-select-saved-global-map nil |
56083
d62a2b6e582e
Doc fixes: say "PC Selection mode", not "`pc-selection-mode'".
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
128 "The global map that was in effect when PC Selection mode was toggled on.") |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
129 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
130 (defvar pc-select-key-bindings-alist nil |
56083
d62a2b6e582e
Doc fixes: say "PC Selection mode", not "`pc-selection-mode'".
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
131 "This alist holds all the key bindings PC Selection mode sets.") |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
132 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
133 (defvar pc-select-default-key-bindings nil |
56083
d62a2b6e582e
Doc fixes: say "PC Selection mode", not "`pc-selection-mode'".
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
134 "These key bindings always get set by PC Selection mode.") |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
135 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
136 (unless pc-select-default-key-bindings |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
137 (let ((lst |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
138 ;; This is to avoid confusion with the delete-selection-mode. |
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
139 ;; On simple displays you can't see that a region is active and |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
140 ;; will be deleted on the next keypress IMHO especially for |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
141 ;; copy-region-as-kill this is confusing. |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
142 ;; The same goes for exchange-point-and-mark |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
143 '(("\M-w" . copy-region-as-kill-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
144 ("\C-x\C-x" . exchange-point-and-mark-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
145 ([S-right] . forward-char-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
146 ([right] . forward-char-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
147 ([C-S-right] . forward-word-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
148 ([C-right] . forward-word-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
149 ([S-left] . backward-char-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
150 ([left] . backward-char-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
151 ([C-S-left] . backward-word-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
152 ([C-left] . backward-word-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
153 ([S-down] . next-line-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
154 ([down] . next-line-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
155 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
156 ([S-end] . end-of-line-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
157 ([end] . end-of-line-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
158 ([S-C-end] . end-of-buffer-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
159 ([C-end] . end-of-buffer-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
160 ([S-M-end] . end-of-buffer-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
161 ([M-end] . end-of-buffer-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
162 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
163 ([S-next] . scroll-up-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
164 ([next] . scroll-up-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
165 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
166 ([S-up] . previous-line-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
167 ([up] . previous-line-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
168 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
169 ([S-home] . beginning-of-line-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
170 ([home] . beginning-of-line-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
171 ([S-C-home] . beginning-of-buffer-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
172 ([C-home] . beginning-of-buffer-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
173 ([S-M-home] . beginning-of-buffer-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
174 ([M-home] . beginning-of-buffer-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
175 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
176 ([M-S-down] . forward-line-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
177 ([M-down] . forward-line-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
178 ([M-S-up] . backward-line-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
179 ([M-up] . backward-line-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
180 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
181 ([S-prior] . scroll-down-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
182 ([prior] . scroll-down-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
183 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
184 ;; Next four lines are from Pete Forman. |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
185 ([C-down] . forward-paragraph-nomark) ; KNextPara cDn |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
186 ([C-up] . backward-paragraph-nomark) ; KPrevPara cUp |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
187 ([S-C-down] . forward-paragraph-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
188 ([S-C-up] . backward-paragraph-mark)))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43985
diff
changeset
|
189 |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
190 (setq pc-select-default-key-bindings lst))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
191 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
192 (defvar pc-select-extra-key-bindings nil |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
193 "Key bindings to set only if `pc-select-selection-keys-only' is nil.") |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
194 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
195 ;; The following keybindings are for standard ISO keyboards |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
196 ;; as they are used with IBM compatible PCs, IBM RS/6000, |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
197 ;; MACs, many X-Stations and probably more |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
198 (unless pc-select-extra-key-bindings |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
199 (let ((lst |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
200 '(([S-insert] . yank) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
201 ([C-insert] . copy-region-as-kill) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
202 ([S-delete] . kill-region) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
203 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
204 ;; The following bindings are useful on Sun Type 3 keyboards |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
205 ;; They implement the Get-Delete-Put (copy-cut-paste) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
206 ;; functions from sunview on the L6, L8 and L10 keys |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
207 ;; Sam Steingold <sds@gnu.org> says that f16 is copy and f18 is paste. |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
208 ([f16] . copy-region-as-kill) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
209 ([f18] . yank) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
210 ([f20] . kill-region) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
211 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
212 ;; The following bindings are from Pete Forman. |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
213 ([f6] . other-window) ; KNextPane F6 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
214 ([C-delete] . kill-line) ; KEraseEndLine cDel |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
215 ("\M-\d" . undo) ; KUndo aBS |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
216 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
217 ;; The following binding is taken from pc-mode.el |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
218 ;; as suggested by RMS. |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
219 ;; I only used the one that is not covered above. |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
220 ([C-M-delete] . kill-sexp) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
221 ;; Next line proposed by Eli Barzilay |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
222 ([C-escape] . electric-buffer-list)))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43985
diff
changeset
|
223 |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
224 (setq pc-select-extra-key-bindings lst))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
225 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
226 (defvar pc-select-meta-moves-sexps-key-bindings |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
227 '((([M-S-right] . forward-sexp-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
228 ([M-right] . forward-sexp-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
229 ([M-S-left] . backward-sexp-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
230 ([M-left] . backward-sexp-nomark)) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
231 (([M-S-right] . forward-word-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
232 ([M-right] . forward-word-nomark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
233 ([M-S-left] . backward-word-mark) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
234 ([M-left] . backward-word-nomark))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
235 "The list of key bindings controlled by `pc-select-meta-moves-sexp'. |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
236 The bindings in the car of this list get installed if |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
237 `pc-select-meta-moves-sexp' is t, the bindings in the cadr of this |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
238 list get installed otherwise.") |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
239 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
240 ;; This is for tty. We don't turn on normal-erase-is-backspace, |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
241 ;; but bind keys as pc-selection-mode did before |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
242 ;; normal-erase-is-backspace was invented, to keep us back |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
243 ;; compatible. |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
244 (defvar pc-select-tty-key-bindings |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
245 '(([delete] . delete-char) ; KDelete Del |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
246 ([C-backspace] . backward-kill-word)) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
247 "The list of key bindings controlled by `pc-select-selection-keys-only'. |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
248 These key bindings get installed when running in a tty, but only if |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
249 `pc-select-selection-keys-only' is nil.") |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
250 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
251 (defvar pc-select-old-M-delete-binding nil |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
252 "Holds the old mapping of [M-delete] in the `function-key-map'. |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
253 This variable holds the value associated with [M-delete] in the |
56083
d62a2b6e582e
Doc fixes: say "PC Selection mode", not "`pc-selection-mode'".
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
254 `function-key-map' before PC Selection mode had changed that |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
255 association.") |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
256 |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
257 (defvar pc-select-shifted-mark nil |
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
258 "Holds whether we ourselves did activate the mark. Only then |
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
259 should we deactivate if later on.") |
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
260 |
13233 | 261 ;;;; |
262 ;; misc | |
263 ;;;; | |
264 | |
265 (provide 'pc-select) | |
266 | |
267 (defun copy-region-as-kill-nomark (beg end) | |
268 "Save the region as if killed; but don't kill it; deactivate mark. | |
269 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
|
270 system cut and paste. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
271 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
272 Deactivating mark is to avoid confusion with `delete-selection-mode' |
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
273 and `transient-mark-mode'." |
13233 | 274 (interactive "r") |
275 (copy-region-as-kill beg end) | |
276 (setq mark-active nil) | |
277 (message "Region saved")) | |
278 | |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
279 (defun exchange-point-and-mark-nomark () |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
280 "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
|
281 (interactive) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
282 (exchange-point-and-mark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
283 (setq mark-active nil)) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
284 |
13233 | 285 ;;;; |
286 ;; non-interactive | |
287 ;;;; | |
288 (defun ensure-mark() | |
289 ;; make sure mark is active | |
290 ;; test if it is active, if it isn't, set it and activate it | |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
291 (or mark-active (set-mark-command nil)) |
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
292 (setq pc-select-shifted-mark t)) |
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
293 |
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
294 (defun maybe-deactivate-mark() |
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
295 ;; maybe switch off mark (only if *we* switched it on) |
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
296 (if pc-select-shifted-mark |
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
297 (progn |
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
298 (setq mark-active nil) |
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
299 (setq pc-select-shifted-mark nil)))) |
13233 | 300 |
301 ;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
302 ;;;;; forward and mark | |
303 ;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
304 | |
305 (defun forward-char-mark (&optional arg) | |
306 "Ensure mark is active; move point right ARG characters (left if ARG negative). | |
307 On reaching end of buffer, stop and signal error." | |
308 (interactive "p") | |
309 (ensure-mark) | |
310 (forward-char arg)) | |
311 | |
312 (defun forward-word-mark (&optional arg) | |
313 "Ensure mark is active; move point right ARG words (backward if ARG is negative). | |
314 Normally returns t. | |
315 If an edge of the buffer is reached, point is left there | |
316 and nil is returned." | |
317 (interactive "p") | |
318 (ensure-mark) | |
319 (forward-word arg)) | |
320 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
321 (defun forward-line-mark (&optional arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
322 "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
|
323 (interactive "p") |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
324 (ensure-mark) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
325 (forward-line arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
326 (setq this-command 'forward-line) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
327 ) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
328 |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
329 (defun forward-sexp-mark (&optional arg) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
330 "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
|
331 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
|
332 move backward across N balanced expressions." |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
333 (interactive "p") |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
334 (ensure-mark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
335 (forward-sexp arg)) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
336 |
13233 | 337 (defun forward-paragraph-mark (&optional arg) |
338 "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
|
339 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
|
340 |
13233 | 341 A line which `paragraph-start' matches either separates paragraphs |
14382 | 342 \(if `paragraph-separate' matches it also) or is the first line of a paragraph. |
13233 | 343 A paragraph end is the beginning of a line which is not part of the paragraph |
344 to which the end of the previous line belongs, or the end of the buffer." | |
345 (interactive "p") | |
346 (ensure-mark) | |
347 (forward-paragraph arg)) | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
348 |
13233 | 349 (defun next-line-mark (&optional arg) |
350 "Ensure mark is active; move cursor vertically down ARG lines. | |
351 If there is no character in the target line exactly under the current column, | |
352 the cursor is positioned after the character in that line which spans this | |
353 column, or at the end of the line if it is not long enough. | |
354 If there is no line in the buffer after this one, behavior depends on the | |
355 value of `next-line-add-newlines'. If non-nil, it inserts a newline character | |
356 to create a line, and moves the cursor to that line. Otherwise it moves the | |
357 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
|
358 is signaled). |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
359 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
360 The command \\[set-goal-column] can be used to create |
13233 | 361 a semipermanent goal column to which this command always moves. |
362 Then it does not try to move vertically. This goal column is stored | |
363 in `goal-column', which is nil when there is none." | |
364 (interactive "p") | |
365 (ensure-mark) | |
85686
a55a536ce0db
* emulation/pc-select.el (next-line-mark, next-line-nomark)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78218
diff
changeset
|
366 (with-no-warnings (next-line arg)) |
14382 | 367 (setq this-command 'next-line)) |
13233 | 368 |
369 (defun end-of-line-mark (&optional arg) | |
370 "Ensure mark is active; move point to end of current line. | |
371 With argument ARG not nil or 1, move forward ARG - 1 lines first. | |
372 If scan reaches end of buffer, stop there without error." | |
373 (interactive "p") | |
374 (ensure-mark) | |
14382 | 375 (end-of-line arg) |
376 (setq this-command 'end-of-line)) | |
13233 | 377 |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
378 (defun backward-line-mark (&optional arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
379 "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
|
380 (interactive "p") |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
381 (ensure-mark) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
382 (if (null arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
383 (setq arg 1)) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
384 (forward-line (- arg)) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
385 (setq this-command 'forward-line) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
386 ) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
387 |
13233 | 388 (defun scroll-down-mark (&optional arg) |
389 "Ensure mark is active; scroll down ARG lines; or near full screen if no ARG. | |
390 A near full screen is `next-screen-context-lines' less than a full screen. | |
391 Negative ARG means scroll upward. | |
392 When calling from a program, supply a number as argument or nil." | |
30792 | 393 (interactive "P") |
13233 | 394 (ensure-mark) |
15931
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
395 (cond (pc-select-override-scroll-error |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
396 (condition-case nil (scroll-down arg) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
397 (beginning-of-buffer (goto-char (point-min))))) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
398 (t (scroll-down arg)))) |
13233 | 399 |
400 (defun end-of-buffer-mark (&optional arg) | |
401 "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
|
402 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
|
403 |
13233 | 404 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
|
405 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
406 |
13233 | 407 Don't use this command in Lisp programs! |
408 \(goto-char \(point-max)) is faster and avoids clobbering the mark." | |
409 (interactive "P") | |
410 (ensure-mark) | |
411 (let ((size (- (point-max) (point-min)))) | |
412 (goto-char (if arg | |
413 (- (point-max) | |
414 (if (> size 10000) | |
415 ;; Avoid overflow for large buffer sizes! | |
416 (* (prefix-numeric-value arg) | |
417 (/ size 10)) | |
418 (/ (* size (prefix-numeric-value arg)) 10))) | |
419 (point-max)))) | |
420 ;; If we went to a place in the middle of the buffer, | |
421 ;; adjust it to the beginning of a line. | |
422 (if arg (forward-line 1) | |
423 ;; If the end of the buffer is not already on the screen, | |
424 ;; then scroll specially to put it near, but not at, the bottom. | |
425 (if (let ((old-point (point))) | |
426 (save-excursion | |
427 (goto-char (window-start)) | |
428 (vertical-motion (window-height)) | |
429 (< (point) old-point))) | |
430 (progn | |
431 (overlay-recenter (point)) | |
432 (recenter -3))))) | |
433 | |
434 ;;;;;;;;; | |
435 ;;;;; no mark | |
436 ;;;;;;;;; | |
437 | |
438 (defun forward-char-nomark (&optional arg) | |
439 "Deactivate mark; move point right ARG characters \(left if ARG negative). | |
440 On reaching end of buffer, stop and signal error." | |
441 (interactive "p") | |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
442 (maybe-deactivate-mark) |
13233 | 443 (forward-char arg)) |
444 | |
445 (defun forward-word-nomark (&optional arg) | |
446 "Deactivate mark; move point right ARG words \(backward if ARG is negative). | |
447 Normally returns t. | |
448 If an edge of the buffer is reached, point is left there | |
449 and nil is returned." | |
450 (interactive "p") | |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
451 (maybe-deactivate-mark) |
13233 | 452 (forward-word arg)) |
453 | |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
454 (defun forward-line-nomark (&optional arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
455 "Deactivate mark; move cursor vertically down ARG lines." |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
456 (interactive "p") |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
457 (maybe-deactivate-mark) |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
458 (forward-line arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
459 (setq this-command 'forward-line) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
460 ) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
461 |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
462 (defun forward-sexp-nomark (&optional arg) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
463 "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
|
464 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
|
465 move backward across N balanced expressions." |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
466 (interactive "p") |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
467 (maybe-deactivate-mark) |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
468 (forward-sexp arg)) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
469 |
13233 | 470 (defun forward-paragraph-nomark (&optional arg) |
471 "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
|
472 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
|
473 |
13233 | 474 A line which `paragraph-start' matches either separates paragraphs |
14382 | 475 \(if `paragraph-separate' matches it also) or is the first line of a paragraph. |
13233 | 476 A paragraph end is the beginning of a line which is not part of the paragraph |
477 to which the end of the previous line belongs, or the end of the buffer." | |
478 (interactive "p") | |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
479 (maybe-deactivate-mark) |
13233 | 480 (forward-paragraph arg)) |
481 | |
482 (defun next-line-nomark (&optional arg) | |
483 "Deactivate mark; move cursor vertically down ARG lines. | |
484 If there is no character in the target line exactly under the current column, | |
485 the cursor is positioned after the character in that line which spans this | |
486 column, or at the end of the line if it is not long enough. | |
487 If there is no line in the buffer after this one, behavior depends on the | |
488 value of `next-line-add-newlines'. If non-nil, it inserts a newline character | |
489 to create a line, and moves the cursor to that line. Otherwise it moves the | |
490 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
|
491 is signaled). |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
492 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
493 The command \\[set-goal-column] can be used to create |
13233 | 494 a semipermanent goal column to which this command always moves. |
495 Then it does not try to move vertically. This goal column is stored | |
496 in `goal-column', which is nil when there is none." | |
497 (interactive "p") | |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
498 (maybe-deactivate-mark) |
85686
a55a536ce0db
* emulation/pc-select.el (next-line-mark, next-line-nomark)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78218
diff
changeset
|
499 (with-no-warnings (next-line arg)) |
14382 | 500 (setq this-command 'next-line)) |
13233 | 501 |
502 (defun end-of-line-nomark (&optional arg) | |
503 "Deactivate mark; move point to end of current line. | |
504 With argument ARG not nil or 1, move forward ARG - 1 lines first. | |
505 If scan reaches end of buffer, stop there without error." | |
506 (interactive "p") | |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
507 (maybe-deactivate-mark) |
14382 | 508 (end-of-line arg) |
509 (setq this-command 'end-of-line)) | |
13233 | 510 |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
511 (defun backward-line-nomark (&optional arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
512 "Deactivate mark; move cursor vertically up ARG lines." |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
513 (interactive "p") |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
514 (maybe-deactivate-mark) |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
515 (if (null arg) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
516 (setq arg 1)) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
517 (forward-line (- arg)) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
518 (setq this-command 'forward-line) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
519 ) |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
520 |
13233 | 521 (defun scroll-down-nomark (&optional arg) |
522 "Deactivate mark; scroll down ARG lines; or near full screen if no ARG. | |
523 A near full screen is `next-screen-context-lines' less than a full screen. | |
524 Negative ARG means scroll upward. | |
525 When calling from a program, supply a number as argument or nil." | |
526 (interactive "P") | |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
527 (maybe-deactivate-mark) |
15931
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
528 (cond (pc-select-override-scroll-error |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
529 (condition-case nil (scroll-down arg) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
530 (beginning-of-buffer (goto-char (point-min))))) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
531 (t (scroll-down arg)))) |
13233 | 532 |
533 (defun end-of-buffer-nomark (&optional arg) | |
534 "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
|
535 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
|
536 |
13233 | 537 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
|
538 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
539 |
13233 | 540 Don't use this command in Lisp programs! |
14382 | 541 \(goto-char (point-max)) is faster and avoids clobbering the mark." |
13233 | 542 (interactive "P") |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
543 (maybe-deactivate-mark) |
13233 | 544 (let ((size (- (point-max) (point-min)))) |
545 (goto-char (if arg | |
546 (- (point-max) | |
547 (if (> size 10000) | |
548 ;; Avoid overflow for large buffer sizes! | |
549 (* (prefix-numeric-value arg) | |
550 (/ size 10)) | |
551 (/ (* size (prefix-numeric-value arg)) 10))) | |
552 (point-max)))) | |
553 ;; If we went to a place in the middle of the buffer, | |
554 ;; adjust it to the beginning of a line. | |
555 (if arg (forward-line 1) | |
556 ;; If the end of the buffer is not already on the screen, | |
557 ;; then scroll specially to put it near, but not at, the bottom. | |
558 (if (let ((old-point (point))) | |
559 (save-excursion | |
560 (goto-char (window-start)) | |
561 (vertical-motion (window-height)) | |
562 (< (point) old-point))) | |
563 (progn | |
564 (overlay-recenter (point)) | |
565 (recenter -3))))) | |
566 | |
567 | |
568 ;;;;;;;;;;;;;;;;;;;; | |
569 ;;;;;; backwards and mark | |
570 ;;;;;;;;;;;;;;;;;;;; | |
571 | |
572 (defun backward-char-mark (&optional arg) | |
573 "Ensure mark is active; move point left ARG characters (right if ARG negative). | |
574 On attempt to pass beginning or end of buffer, stop and signal error." | |
575 (interactive "p") | |
576 (ensure-mark) | |
577 (backward-char arg)) | |
578 | |
579 (defun backward-word-mark (&optional arg) | |
580 "Ensure mark is active; move backward until encountering the end of a word. | |
581 With argument, do this that many times." | |
582 (interactive "p") | |
583 (ensure-mark) | |
584 (backward-word arg)) | |
585 | |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
586 (defun backward-sexp-mark (&optional arg) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
587 "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
|
588 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
|
589 move forward across N balanced expressions." |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
590 (interactive "p") |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
591 (ensure-mark) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
592 (backward-sexp arg)) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
593 |
13233 | 594 (defun backward-paragraph-mark (&optional arg) |
595 "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
|
596 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
|
597 |
13233 | 598 A paragraph start is the beginning of a line which is a |
599 `first-line-of-paragraph' or which is ordinary text and follows a | |
600 paragraph-separating line; except: if the first real line of a | |
601 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
|
602 blank line. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
603 |
13233 | 604 See `forward-paragraph' for more information." |
605 (interactive "p") | |
606 (ensure-mark) | |
607 (backward-paragraph arg)) | |
608 | |
609 (defun previous-line-mark (&optional arg) | |
610 "Ensure mark is active; move cursor vertically up ARG lines. | |
611 If there is no character in the target line exactly over the current column, | |
612 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
|
613 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
|
614 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
615 The command \\[set-goal-column] can be used to create |
13233 | 616 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
|
617 Then it does not try to move vertically. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
618 |
13233 | 619 If you are thinking of using this in a Lisp program, consider using |
620 `forward-line' with a negative argument instead. It is usually easier | |
621 to use and more reliable (no dependence on goal column, etc.)." | |
622 (interactive "p") | |
623 (ensure-mark) | |
85686
a55a536ce0db
* emulation/pc-select.el (next-line-mark, next-line-nomark)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78218
diff
changeset
|
624 (with-no-warnings (previous-line arg)) |
14382 | 625 (setq this-command 'previous-line)) |
13233 | 626 |
627 (defun beginning-of-line-mark (&optional arg) | |
628 "Ensure mark is active; move point to beginning of current line. | |
629 With argument ARG not nil or 1, move forward ARG - 1 lines first. | |
630 If scan reaches end of buffer, stop there without error." | |
631 (interactive "p") | |
632 (ensure-mark) | |
633 (beginning-of-line arg)) | |
634 | |
635 | |
636 (defun scroll-up-mark (&optional arg) | |
637 "Ensure mark is active; scroll upward ARG lines; or near full screen if no ARG. | |
638 A near full screen is `next-screen-context-lines' less than a full screen. | |
639 Negative ARG means scroll downward. | |
640 When calling from a program, supply a number as argument or nil." | |
641 (interactive "P") | |
642 (ensure-mark) | |
15931
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
643 (cond (pc-select-override-scroll-error |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
644 (condition-case nil (scroll-up arg) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
645 (end-of-buffer (goto-char (point-max))))) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
646 (t (scroll-up arg)))) |
13233 | 647 |
648 (defun beginning-of-buffer-mark (&optional arg) | |
649 "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
|
650 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
|
651 |
13233 | 652 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
|
653 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
654 |
13233 | 655 Don't use this command in Lisp programs! |
656 \(goto-char (p\oint-min)) is faster and avoids clobbering the mark." | |
657 (interactive "P") | |
30792 | 658 (ensure-mark) |
13233 | 659 (let ((size (- (point-max) (point-min)))) |
660 (goto-char (if arg | |
661 (+ (point-min) | |
662 (if (> size 10000) | |
663 ;; Avoid overflow for large buffer sizes! | |
664 (* (prefix-numeric-value arg) | |
665 (/ size 10)) | |
666 (/ (+ 10 (* size (prefix-numeric-value arg))) 10))) | |
667 (point-min)))) | |
668 (if arg (forward-line 1))) | |
669 | |
670 ;;;;;;;; | |
671 ;;; no mark | |
672 ;;;;;;;; | |
673 | |
674 (defun backward-char-nomark (&optional arg) | |
675 "Deactivate mark; move point left ARG characters (right if ARG negative). | |
676 On attempt to pass beginning or end of buffer, stop and signal error." | |
677 (interactive "p") | |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
678 (maybe-deactivate-mark) |
13233 | 679 (backward-char arg)) |
680 | |
681 (defun backward-word-nomark (&optional arg) | |
682 "Deactivate mark; move backward until encountering the end of a word. | |
683 With argument, do this that many times." | |
684 (interactive "p") | |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
685 (maybe-deactivate-mark) |
13233 | 686 (backward-word arg)) |
687 | |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
688 (defun backward-sexp-nomark (&optional arg) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
689 "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
|
690 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
|
691 move forward across N balanced expressions." |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
692 (interactive "p") |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
693 (maybe-deactivate-mark) |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
694 (backward-sexp arg)) |
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
695 |
13233 | 696 (defun backward-paragraph-nomark (&optional arg) |
697 "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
|
698 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
|
699 |
13233 | 700 A paragraph start is the beginning of a line which is a |
701 `first-line-of-paragraph' or which is ordinary text and follows a | |
702 paragraph-separating line; except: if the first real line of a | |
703 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
|
704 blank line. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
705 |
13233 | 706 See `forward-paragraph' for more information." |
707 (interactive "p") | |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
708 (maybe-deactivate-mark) |
13233 | 709 (backward-paragraph arg)) |
710 | |
711 (defun previous-line-nomark (&optional arg) | |
712 "Deactivate mark; move cursor vertically up ARG lines. | |
713 If there is no character in the target line exactly over the current column, | |
714 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
|
715 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
|
716 |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
717 The command \\[set-goal-column] can be used to create |
13233 | 718 a semipermanent goal column to which this command always moves. |
719 Then it does not try to move vertically." | |
720 (interactive "p") | |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
721 (maybe-deactivate-mark) |
85686
a55a536ce0db
* emulation/pc-select.el (next-line-mark, next-line-nomark)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78218
diff
changeset
|
722 (with-no-warnings (previous-line arg)) |
14382 | 723 (setq this-command 'previous-line)) |
13233 | 724 |
725 (defun beginning-of-line-nomark (&optional arg) | |
726 "Deactivate mark; move point to beginning of current line. | |
727 With argument ARG not nil or 1, move forward ARG - 1 lines first. | |
728 If scan reaches end of buffer, stop there without error." | |
729 (interactive "p") | |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
730 (maybe-deactivate-mark) |
13233 | 731 (beginning-of-line arg)) |
732 | |
733 (defun scroll-up-nomark (&optional arg) | |
734 "Deactivate mark; scroll upward ARG lines; or near full screen if no ARG. | |
735 A near full screen is `next-screen-context-lines' less than a full screen. | |
736 Negative ARG means scroll downward. | |
737 When calling from a program, supply a number as argument or nil." | |
738 (interactive "P") | |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
739 (maybe-deactivate-mark) |
15931
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
740 (cond (pc-select-override-scroll-error |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
741 (condition-case nil (scroll-up arg) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
742 (end-of-buffer (goto-char (point-max))))) |
c729af982039
(ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
15907
diff
changeset
|
743 (t (scroll-up arg)))) |
13233 | 744 |
745 (defun beginning-of-buffer-nomark (&optional arg) | |
746 "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
|
747 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
|
748 |
13233 | 749 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
|
750 of the accessible part of the buffer. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
751 |
13233 | 752 Don't use this command in Lisp programs! |
14382 | 753 \(goto-char (point-min)) is faster and avoids clobbering the mark." |
13233 | 754 (interactive "P") |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
755 (maybe-deactivate-mark) |
13233 | 756 (let ((size (- (point-max) (point-min)))) |
757 (goto-char (if arg | |
758 (+ (point-min) | |
759 (if (> size 10000) | |
760 ;; Avoid overflow for large buffer sizes! | |
761 (* (prefix-numeric-value arg) | |
762 (/ size 10)) | |
763 (/ (+ 10 (* size (prefix-numeric-value arg))) 10))) | |
764 (point-min)))) | |
765 (if arg (forward-line 1))) | |
766 | |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
767 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
768 (defun pc-select-define-keys (alist keymap) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
769 "Make KEYMAP have the key bindings specified in ALIST." |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
770 (let ((lst alist)) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
771 (while lst |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
772 (define-key keymap (caar lst) (cdar lst)) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
773 (setq lst (cdr lst))))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
774 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
775 (defun pc-select-restore-keys (alist keymap saved-map) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
776 "Use ALIST to restore key bindings from SAVED-MAP into KEYMAP. |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
777 Go through all the key bindings in ALIST, and, for each key |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
778 binding, if KEYMAP and ALIST still agree on the key binding, |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
779 restore the previous value of that key binding from SAVED-MAP." |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
780 (let ((lst alist)) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
781 (while lst |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
782 (when (equal (lookup-key keymap (caar lst)) (cdar lst)) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
783 (define-key keymap (caar lst) (lookup-key saved-map (caar lst)))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
784 (setq lst (cdr lst))))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
785 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
786 (defmacro pc-select-add-to-alist (alist var val) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
787 "Ensure that ALIST contains the cons cell (VAR . VAL). |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
788 If a cons cell whose car is VAR is already on the ALIST, update the |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43985
diff
changeset
|
789 cdr of that cell with VAL. Otherwise, make a new cons cell |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
790 \(VAR . VAL), and prepend it onto ALIST." |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
791 (let ((elt (make-symbol "elt"))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
792 `(let ((,elt (assq ',var ,alist))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
793 (if ,elt |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
794 (setcdr ,elt ,val) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
795 (setq ,alist (cons (cons ',var ,val) ,alist)))))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
796 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
797 (defmacro pc-select-save-and-set-var (var newval) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
798 "Set VAR to NEWVAL; save the old value. |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
799 The old value is saved on the `pc-select-saved-settings-alist'." |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
800 `(when (boundp ',var) |
43025
32f6fb5c961f
(pc-select-save-and-set-mode): Properly use MODE-VAR.
Richard M. Stallman <rms@gnu.org>
parents:
42980
diff
changeset
|
801 (pc-select-add-to-alist pc-select-saved-settings-alist ,var ,var) |
32f6fb5c961f
(pc-select-save-and-set-mode): Properly use MODE-VAR.
Richard M. Stallman <rms@gnu.org>
parents:
42980
diff
changeset
|
802 (setq ,var ,newval))) |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
803 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
804 (defmacro pc-select-save-and-set-mode (mode &optional arg mode-var) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
805 "Call the function MODE; save the old value of the variable MODE. |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
806 MODE is presumed to be a function which turns on a minor mode. First, |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
807 save the value of the variable MODE on `pc-select-saved-settings-alist'. |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
808 Then, if ARG is specified, call MODE with ARG, otherwise call it with |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
809 nil as an argument. If MODE-VAR is specified, save the value of the |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
810 variable MODE-VAR (instead of the value of the variable MODE) on |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
811 `pc-select-saved-settings-alist'." |
43025
32f6fb5c961f
(pc-select-save-and-set-mode): Properly use MODE-VAR.
Richard M. Stallman <rms@gnu.org>
parents:
42980
diff
changeset
|
812 (unless mode-var (setq mode-var mode)) |
32f6fb5c961f
(pc-select-save-and-set-mode): Properly use MODE-VAR.
Richard M. Stallman <rms@gnu.org>
parents:
42980
diff
changeset
|
813 `(when (fboundp ',mode) |
32f6fb5c961f
(pc-select-save-and-set-mode): Properly use MODE-VAR.
Richard M. Stallman <rms@gnu.org>
parents:
42980
diff
changeset
|
814 (pc-select-add-to-alist pc-select-saved-settings-alist |
32f6fb5c961f
(pc-select-save-and-set-mode): Properly use MODE-VAR.
Richard M. Stallman <rms@gnu.org>
parents:
42980
diff
changeset
|
815 ,mode-var ,mode-var) |
32f6fb5c961f
(pc-select-save-and-set-mode): Properly use MODE-VAR.
Richard M. Stallman <rms@gnu.org>
parents:
42980
diff
changeset
|
816 (,mode ,arg))) |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
817 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
818 (defmacro pc-select-restore-var (var) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43985
diff
changeset
|
819 "Restore the previous value of the variable VAR. |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
820 Look up VAR's previous value in `pc-select-saved-settings-alist', and, |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
821 if the value is found, set VAR to that value." |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
822 (let ((elt (make-symbol "elt"))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
823 `(let ((,elt (assq ',var pc-select-saved-settings-alist))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
824 (unless (null ,elt) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
825 (setq ,var (cdr ,elt)))))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
826 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
827 (defmacro pc-select-restore-mode (mode) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
828 "Restore the previous state (either on or off) of the minor mode MODE. |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
829 Look up the value of the variable MODE on `pc-select-saved-settings-alist'. |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
830 If the value is non-nil, call the function MODE with an argument of |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
831 1, otherwise call it with an argument of -1." |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
832 (let ((elt (make-symbol "elt"))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
833 `(when (fboundp ',mode) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
834 (let ((,elt (assq ',mode pc-select-saved-settings-alist))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
835 (unless (null ,elt) |
43025
32f6fb5c961f
(pc-select-save-and-set-mode): Properly use MODE-VAR.
Richard M. Stallman <rms@gnu.org>
parents:
42980
diff
changeset
|
836 (,mode (if (cdr ,elt) 1 -1))))))) |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
837 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
838 |
13234
e3b1df16f4b4
(pc-selection-mode): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
13233
diff
changeset
|
839 ;;;###autoload |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
840 (define-minor-mode pc-selection-mode |
63266
0a2deeba6710
(pc-select-selection-keys-only, pc-selection-mode): Fix spellings in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
62440
diff
changeset
|
841 "Change mark behavior to emulate Motif, MAC or MS-Windows cut and paste style. |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
842 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
843 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
|
844 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
845 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
|
846 which modify the status of the mark. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
847 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
848 The ordinary arrow keys disable the mark. |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
849 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
|
850 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
851 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
|
852 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
|
853 |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
854 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
|
855 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
|
856 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
|
857 variable `pc-select-meta-moves-sexps' after loading pc-select.el but before |
56083
d62a2b6e582e
Doc fixes: say "PC Selection mode", not "`pc-selection-mode'".
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
858 turning PC Selection mode on. |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
859 |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
860 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
|
861 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
|
862 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
863 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
|
864 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
|
865 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
|
866 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
867 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
|
868 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
|
869 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
|
870 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
871 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
|
872 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
|
873 |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
874 S-DELETE kills the region (`kill-region'). |
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
875 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
|
876 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
|
877 |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
878 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
|
879 the variable `pc-select-selection-keys-only' to t after loading pc-select.el |
56083
d62a2b6e582e
Doc fixes: say "PC Selection mode", not "`pc-selection-mode'".
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
880 but before calling PC Selection mode): |
15907
c25492075289
Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
14734
diff
changeset
|
881 |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
882 F6 other-window |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
883 DELETE delete-char |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
884 C-DELETE kill-line |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
885 M-DELETE kill-word |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
886 C-M-DELETE kill-sexp |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
887 C-BACKSPACE backward-kill-word |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
888 M-BACKSPACE undo" |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
889 ;; FIXME: bring pc-bindings-mode here ? |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
890 nil nil nil |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
891 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
892 :group 'pc-select |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
893 :global t |
13233 | 894 |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
895 (if pc-selection-mode |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
896 (if (null pc-select-key-bindings-alist) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
897 (progn |
43985
2fab49a69d94
(pc-selection-mode): Alter the existing global map, don't replace it.
Richard M. Stallman <rms@gnu.org>
parents:
43025
diff
changeset
|
898 (setq pc-select-saved-global-map (copy-keymap (current-global-map))) |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
899 (setq pc-select-key-bindings-alist |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
900 (append pc-select-default-key-bindings |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
901 (if pc-select-selection-keys-only |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
902 nil |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
903 pc-select-extra-key-bindings) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
904 (if pc-select-meta-moves-sexps |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
905 (car pc-select-meta-moves-sexps-key-bindings) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
906 (cadr pc-select-meta-moves-sexps-key-bindings)) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
907 (if (or pc-select-selection-keys-only |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
908 (eq window-system 'x) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
909 (memq system-name '(ms-dos windows-nt))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
910 nil |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
911 pc-select-tty-key-bindings))) |
13233 | 912 |
43985
2fab49a69d94
(pc-selection-mode): Alter the existing global map, don't replace it.
Richard M. Stallman <rms@gnu.org>
parents:
43025
diff
changeset
|
913 (pc-select-define-keys pc-select-key-bindings-alist |
2fab49a69d94
(pc-selection-mode): Alter the existing global map, don't replace it.
Richard M. Stallman <rms@gnu.org>
parents:
43025
diff
changeset
|
914 (current-global-map)) |
13233 | 915 |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
916 (unless (or pc-select-selection-keys-only |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
917 (eq window-system 'x) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
918 (memq system-name '(ms-dos windows-nt))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
919 ;; it is not clear that we need the following line |
43985
2fab49a69d94
(pc-selection-mode): Alter the existing global map, don't replace it.
Richard M. Stallman <rms@gnu.org>
parents:
43025
diff
changeset
|
920 ;; I hope it doesn't do too much harm to leave it in, though... |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
921 (setq pc-select-old-M-delete-binding |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
922 (lookup-key function-key-map [M-delete])) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
923 (define-key function-key-map [M-delete] [?\M-d])) |
13233 | 924 |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
925 (when (and (not pc-select-selection-keys-only) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
926 (or (eq window-system 'x) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
927 (memq system-name '(ms-dos windows-nt))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
928 (fboundp 'normal-erase-is-backspace-mode)) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
929 (pc-select-save-and-set-mode normal-erase-is-backspace-mode 1 |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
930 normal-erase-is-backspace)) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
931 ;; the original author also had this above: |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
932 ;; (setq-default normal-erase-is-backspace t) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
933 ;; However, the documentation for the variable says that |
43985
2fab49a69d94
(pc-selection-mode): Alter the existing global map, don't replace it.
Richard M. Stallman <rms@gnu.org>
parents:
43025
diff
changeset
|
934 ;; "setting it with setq has no effect", so I'm removing it. |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43985
diff
changeset
|
935 |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
936 (pc-select-save-and-set-var highlight-nonselected-windows nil) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
937 (pc-select-save-and-set-var transient-mark-mode t) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
938 (pc-select-save-and-set-var mark-even-if-inactive t) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
939 (pc-select-save-and-set-mode delete-selection-mode 1)) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
940 ;;else |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
941 ;; If the user turned on pc-selection-mode a second time |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
942 ;; do not clobber the values of the variables that were |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
943 ;; saved from before pc-selection mode was activated -- |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
944 ;; just make sure the values are the way we like them. |
43985
2fab49a69d94
(pc-selection-mode): Alter the existing global map, don't replace it.
Richard M. Stallman <rms@gnu.org>
parents:
43025
diff
changeset
|
945 (pc-select-define-keys pc-select-key-bindings-alist |
2fab49a69d94
(pc-selection-mode): Alter the existing global map, don't replace it.
Richard M. Stallman <rms@gnu.org>
parents:
43025
diff
changeset
|
946 (current-global-map)) |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
947 (unless (or pc-select-selection-keys-only |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
948 (eq window-system 'x) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
949 (memq system-name '(ms-dos windows-nt))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
950 ;; it is not clear that we need the following line |
43985
2fab49a69d94
(pc-selection-mode): Alter the existing global map, don't replace it.
Richard M. Stallman <rms@gnu.org>
parents:
43025
diff
changeset
|
951 ;; I hope it doesn't do too much harm to leave it in, though... |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
952 (define-key function-key-map [M-delete] [?\M-d])) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
953 (when (and (not pc-select-selection-keys-only) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
954 (or (eq window-system 'x) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
955 (memq system-name '(ms-dos windows-nt))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
956 (fboundp 'normal-erase-is-backspace-mode)) |
41299
77b08a460f84
Doc string fixes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
957 (normal-erase-is-backspace-mode 1)) |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
958 (setq highlight-nonselected-windows nil) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
959 (setq transient-mark-mode t) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
960 (setq mark-even-if-inactive t) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
961 (delete-selection-mode 1)) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
962 ;;else |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
963 (when pc-select-key-bindings-alist |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
964 (when (and (not pc-select-selection-keys-only) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
965 (or (eq window-system 'x) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
966 (memq system-name '(ms-dos windows-nt)))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
967 (pc-select-restore-mode normal-erase-is-backspace-mode)) |
13233 | 968 |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
969 (pc-select-restore-keys |
43985
2fab49a69d94
(pc-selection-mode): Alter the existing global map, don't replace it.
Richard M. Stallman <rms@gnu.org>
parents:
43025
diff
changeset
|
970 pc-select-key-bindings-alist (current-global-map) |
2fab49a69d94
(pc-selection-mode): Alter the existing global map, don't replace it.
Richard M. Stallman <rms@gnu.org>
parents:
43025
diff
changeset
|
971 pc-select-saved-global-map) |
18216
75f7eec6d388
(pc-select-selection-keys-only): New variable.
Karl Heuer <kwzh@gnu.org>
parents:
17915
diff
changeset
|
972 |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
973 (pc-select-restore-var highlight-nonselected-windows) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
974 (pc-select-restore-var transient-mark-mode) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
975 (pc-select-restore-var mark-even-if-inactive) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
976 (pc-select-restore-mode delete-selection-mode) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
977 (and pc-select-old-M-delete-binding |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
978 (define-key function-key-map [M-delete] |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
979 pc-select-old-M-delete-binding)) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
980 (setq pc-select-key-bindings-alist nil |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
981 pc-select-saved-settings-alist nil)))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43985
diff
changeset
|
982 |
19289 | 983 |
984 ;;;###autoload | |
985 (defcustom pc-selection-mode nil | |
986 "Toggle PC Selection mode. | |
63266
0a2deeba6710
(pc-select-selection-keys-only, pc-selection-mode): Fix spellings in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
62440
diff
changeset
|
987 Change mark behavior to emulate Motif, MAC or MS-Windows cut and paste style, |
19289 | 988 and cursor movement commands. |
989 This mode enables Delete Selection mode and Transient Mark mode. | |
56083
d62a2b6e582e
Doc fixes: say "PC Selection mode", not "`pc-selection-mode'".
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
990 Setting this variable directly does not take effect; |
d62a2b6e582e
Doc fixes: say "PC Selection mode", not "`pc-selection-mode'".
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
991 you must modify it using \\[customize] or \\[pc-selection-mode]." |
19289 | 992 :set (lambda (symbol value) |
42980
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
993 (pc-selection-mode (if value 1 -1))) |
6134751ae11f
(pc-selection-mode-hook)
Richard M. Stallman <rms@gnu.org>
parents:
41299
diff
changeset
|
994 :initialize 'custom-initialize-default |
19289 | 995 :type 'boolean |
996 :group 'pc-select | |
997 :require 'pc-select) | |
998 | |
86155
39b88001b04b
(pc-select-shifted-mark): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85686
diff
changeset
|
999 ;; arch-tag: 10697b70-ae07-4f3e-ad23-7814a3f418c2 |
13233 | 1000 ;;; pc-select.el ends here |