annotate lisp/emulation/pc-select.el @ 39896:258ac90a4fed

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