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