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