annotate lisp/emulation/pc-select.el @ 18135:000b0a8baf1a

(mail-setup): Don't set buffer-file-coding-system to nil. Instead, kill the local binding of it.
author Richard M. Stallman <rms@gnu.org>
date Tue, 03 Jun 1997 08:17:35 +0000
parents 3c572d848dab
children 75f7eec6d388
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; pc-select.el --- emulate mark, cut, copy and paste from motif
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2 ;;; (or MAC GUI) or MS-windoze (bah)) look-and-feel
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 ;;; including key bindings
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
14734
20f4c4a078b2 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 14382
diff changeset
5 ;; Copyright (C) 1995, 1996 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>
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; Created: 26 Sep 1995
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; 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
14 ;; the Free Software Foundation; either version 2, or (at your option)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; any later version.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; 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
23 ;; 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
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
25 ;; Boston, MA 02111-1307, USA.
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;;; Commentary:
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
28
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; 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
30 ;; 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
31 ;; It modifies the keybindings of the cursor keys and the next, prior,
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; home and end keys. They will modify mark-active.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; You can still get the old behaviour of cursor moving with the
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;; control sequences C-f, C-b, etc.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; This package uses transient-mark-mode and
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;; delete-selection-mode.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; In addition to that all key-bindings from the pc-mode are
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;; done here too (as suggested by RMS).
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;; 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
42 ;; 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
43 ;; delete-selection-mode is very important for the look-and-feel.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; Pete Forman <pete.forman@airgun.wg.waii.com> provided some motif
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; compliant keybindings which I added. I had to modify them a little
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 ;; to add the -mark and -nomark functionality of cursor moving.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; Credits:
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ;; Many thanks to all who made comments.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 ;; 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
51 ;; Kevin Cutts <cutts@ukraine.corp.mot.com> added the beginning-of-buffer
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;; and end-of-buffer functions which I modified a little.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 ;; David Biesack <sasdjb@unx.sas.com> suggested some more cleanup.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 ;; Thanks to Pete Forman <pete.forman@airgun.wg.waii.com>
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ;; for additional motif keybindings.
14382
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
56 ;; 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
57 ;; concerning setting of this-command.
15907
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
58 ;; Dan Nicolaescu <done@nexus.sorostm.ro> suggested suppressing the
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
59 ;; scroll-up/scroll-down error.
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 ;; Ok, some details about the idea of pc-selection-mode:
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 ;; 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
64 ;; prior, next, called "move-keys" from now on) will always de-activate
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 ;; the mark.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 ;; o If you press "Shift" together with the "move-keys", the region
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 ;; you pass along is activated
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 ;; 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
69 ;; which will operate on the active region
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 ;; 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
71 ;; emacs reasons.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ;; 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
73 ;; 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
74 ;; other programs.
15907
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
75 ;;
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76
15907
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
77 ;;;; Customization:
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
78
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
79 (defvar pc-select-override-scroll-error t
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
80 "*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
81 This variable applies in PC Selection mode only.
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
82 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
83 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
84 text with these commands. If you set this variable to non-nil, these
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
85 errors are suppressed.")
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 ;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 ;; misc
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 ;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 (provide 'pc-select)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 (defun copy-region-as-kill-nomark (beg end)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 "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
95 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
96 system cut and paste.
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
97
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 Deactivating mark is to avoid confusion with delete-selection-mode
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 and transient-mark-mode."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 (interactive "r")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 (copy-region-as-kill beg end)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 (message "Region saved"))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 ;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 ;; non-interactive
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 ;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 (defun ensure-mark()
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 ;; make sure mark is active
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 ;; 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
111 (or mark-active (set-mark-command nil)))
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112
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 ;;;;; forward and mark
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
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 forward-char-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 "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
119 On reaching end of buffer, stop and signal error."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 (forward-char arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 (defun forward-word-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 "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
126 Normally returns t.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 If an edge of the buffer is reached, point is left there
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 and nil is returned."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (forward-word arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132
15907
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
133 (defun forward-line-mark (&optional arg)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
134 "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
135 (interactive "p")
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
136 (ensure-mark)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
137 (forward-line arg)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
138 (setq this-command 'forward-line)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
139 )
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
140
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 (defun forward-paragraph-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 "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
143 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
144
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 A line which `paragraph-start' matches either separates paragraphs
14382
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
146 \(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
147 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
148 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
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-paragraph arg))
15907
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
152
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 (defun next-line-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 "Ensure mark is active; move cursor vertically down ARG lines.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 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
156 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
157 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
158 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
159 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
160 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
161 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
162 is signaled).
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
163
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 The command C-x C-n can be used to create
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 a semipermanent goal column to which this command always moves.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 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
167 in `goal-column', which is nil when there is none."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 (ensure-mark)
14382
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
170 (next-line arg)
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
171 (setq this-command 'next-line))
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 (defun end-of-line-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 "Ensure mark is active; move point to end of current line.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 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
176 If scan reaches end of buffer, stop there without error."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 (ensure-mark)
14382
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
179 (end-of-line arg)
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
180 (setq this-command 'end-of-line))
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181
15907
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
182 (defun backward-line-mark (&optional arg)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
183 "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
184 (interactive "p")
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
185 (ensure-mark)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
186 (if (null arg)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
187 (setq arg 1))
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
188 (forward-line (- arg))
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
189 (setq this-command 'forward-line)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
190 )
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
191
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 (defun scroll-down-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 "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
194 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
195 Negative ARG means scroll upward.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 When calling from a program, supply a number as argument or nil."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 (interactive "P")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 (ensure-mark)
15931
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
199 (cond (pc-select-override-scroll-error
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
200 (condition-case nil (scroll-down arg)
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
201 (beginning-of-buffer (goto-char (point-min)))))
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
202 (t (scroll-down arg))))
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 (defun end-of-buffer-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 "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
206 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
207
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 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
209 of the accessible part of the buffer.
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
210
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 Don't use this command in Lisp programs!
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 \(goto-char \(point-max)) is faster and avoids clobbering the mark."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 (interactive "P")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 (let ((size (- (point-max) (point-min))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 (goto-char (if arg
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 (- (point-max)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 (if (> size 10000)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 ;; Avoid overflow for large buffer sizes!
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 (* (prefix-numeric-value arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 (/ size 10))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 (/ (* size (prefix-numeric-value arg)) 10)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 (point-max))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 ;; If we went to a place in the middle of the buffer,
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 ;; adjust it to the beginning of a line.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 (if arg (forward-line 1)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 ;; If the end of the buffer is not already on the screen,
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 ;; then scroll specially to put it near, but not at, the bottom.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 (if (let ((old-point (point)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 (save-excursion
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 (goto-char (window-start))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 (vertical-motion (window-height))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 (< (point) old-point)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 (progn
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 (overlay-recenter (point))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 (recenter -3)))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 ;;;;;;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 ;;;;; no mark
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
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 (defun forward-char-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 "Deactivate mark; move point right ARG characters \(left if ARG negative).
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 On reaching end of buffer, stop and signal error."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 (forward-char arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 (defun forward-word-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 "Deactivate mark; move point right ARG words \(backward if ARG is negative).
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 Normally returns t.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 If an edge of the buffer is reached, point is left there
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 and nil is returned."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 (forward-word arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257
15907
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
258 (defun forward-line-nomark (&optional arg)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
259 "Deactivate mark; move cursor vertically down ARG lines."
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
260 (interactive "p")
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
261 (setq mark-active nil)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
262 (forward-line arg)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
263 (setq this-command 'forward-line)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
264 )
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
265
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 (defun forward-paragraph-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 "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
268 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
269
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 A line which `paragraph-start' matches either separates paragraphs
14382
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
271 \(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
272 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
273 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
274 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 (forward-paragraph arg))
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 (defun next-line-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 "Deactivate mark; move cursor vertically down ARG lines.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 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
281 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
282 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
283 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
284 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
285 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
286 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
287 is signaled).
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
288
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 The command C-x C-n can be used to create
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 a semipermanent goal column to which this command always moves.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 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
292 in `goal-column', which is nil when there is none."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 (setq mark-active nil)
14382
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
295 (next-line arg)
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
296 (setq this-command 'next-line))
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298 (defun end-of-line-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 "Deactivate mark; move point to end of current line.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 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
301 If scan reaches end of buffer, stop there without error."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 (setq mark-active nil)
14382
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
304 (end-of-line arg)
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
305 (setq this-command 'end-of-line))
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306
15907
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
307 (defun backward-line-nomark (&optional arg)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
308 "Deactivate mark; move cursor vertically up ARG lines."
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
309 (interactive "p")
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
310 (setq mark-active nil)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
311 (if (null arg)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
312 (setq arg 1))
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
313 (forward-line (- arg))
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
314 (setq this-command 'forward-line)
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
315 )
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
316
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 (defun scroll-down-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 "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
319 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
320 Negative ARG means scroll upward.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 When calling from a program, supply a number as argument or nil."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 (interactive "P")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 (setq mark-active nil)
15931
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
324 (cond (pc-select-override-scroll-error
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
325 (condition-case nil (scroll-down arg)
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
326 (beginning-of-buffer (goto-char (point-min)))))
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
327 (t (scroll-down arg))))
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 (defun end-of-buffer-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 "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
331 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
332
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333 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
334 of the accessible part of the buffer.
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
335
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336 Don't use this command in Lisp programs!
14382
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
337 \(goto-char (point-max)) is faster and avoids clobbering the mark."
13233
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)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 (let ((size (- (point-max) (point-min))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 (goto-char (if arg
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 (- (point-max)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 (if (> size 10000)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 ;; Avoid overflow for large buffer sizes!
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 (* (prefix-numeric-value arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 (/ size 10))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 (/ (* size (prefix-numeric-value arg)) 10)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 (point-max))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349 ;; If we went to a place in the middle of the buffer,
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 ;; adjust it to the beginning of a line.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351 (if arg (forward-line 1)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 ;; If the end of the buffer is not already on the screen,
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 ;; then scroll specially to put it near, but not at, the bottom.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 (if (let ((old-point (point)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 (save-excursion
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 (goto-char (window-start))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357 (vertical-motion (window-height))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 (< (point) old-point)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 (progn
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360 (overlay-recenter (point))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 (recenter -3)))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364 ;;;;;;;;;;;;;;;;;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365 ;;;;;; backwards and mark
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366 ;;;;;;;;;;;;;;;;;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 (defun backward-char-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 "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
370 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
371 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373 (backward-char arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375 (defun backward-word-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376 "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
377 With argument, do this that many times."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 (backward-word arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 (defun backward-paragraph-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 "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
384 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
385
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 A paragraph start is the beginning of a line which is a
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387 `first-line-of-paragraph' or which is ordinary text and follows a
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 paragraph-separating line; except: if the first real line of a
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389 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
390 blank line.
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
391
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392 See `forward-paragraph' for more information."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
394 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395 (backward-paragraph arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 (defun previous-line-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398 "Ensure mark is active; move cursor vertically up ARG lines.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399 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
400 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
401 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
402
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 The command C-x C-n can be used to create
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 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
405 Then it does not try to move vertically.
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
406
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 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
408 `forward-line' with a negative argument instead. It is usually easier
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 to use and more reliable (no dependence on goal column, etc.)."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 (ensure-mark)
14382
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
412 (previous-line arg)
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
413 (setq this-command 'previous-line))
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
415 (defun beginning-of-line-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416 "Ensure mark is active; move point to beginning of current line.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 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
418 If scan reaches end of buffer, stop there without error."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421 (beginning-of-line arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 (defun scroll-up-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425 "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
426 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
427 Negative ARG means scroll downward.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428 When calling from a program, supply a number as argument or nil."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429 (interactive "P")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430 (ensure-mark)
15931
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
431 (cond (pc-select-override-scroll-error
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
432 (condition-case nil (scroll-up arg)
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
433 (end-of-buffer (goto-char (point-max)))))
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
434 (t (scroll-up arg))))
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436 (defun beginning-of-buffer-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437 "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
438 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
439
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
440 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
441 of the accessible part of the buffer.
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
442
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443 Don't use this command in Lisp programs!
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
444 \(goto-char (p\oint-min)) is faster and avoids clobbering the mark."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 (interactive "P")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447 (let ((size (- (point-max) (point-min))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
448 (goto-char (if arg
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
449 (+ (point-min)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
450 (if (> size 10000)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 ;; Avoid overflow for large buffer sizes!
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452 (* (prefix-numeric-value arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453 (/ size 10))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454 (/ (+ 10 (* size (prefix-numeric-value arg))) 10)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 (point-min))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 (if arg (forward-line 1)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 ;;;;;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 ;;; no mark
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 ;;;;;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 (defun backward-char-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 "Deactivate mark; move point left ARG characters (right if ARG negative).
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 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
465 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 (backward-char arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 (defun backward-word-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 "Deactivate mark; move backward until encountering the end of a word.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 With argument, do this that many times."
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 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 (backward-word 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 (defun backward-paragraph-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
477 "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
478 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
479
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
480 A paragraph start is the beginning of a line which is a
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481 `first-line-of-paragraph' or which is ordinary text and follows a
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 paragraph-separating line; except: if the first real line of a
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 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
484 blank line.
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
485
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 See `forward-paragraph' for more information."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489 (backward-paragraph arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491 (defun previous-line-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
492 "Deactivate mark; move cursor vertically up ARG lines.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493 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
494 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
495 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
496
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 The command C-x C-n can be used to create
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 a semipermanent goal column to which this command always moves.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 Then it does not try to move vertically."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501 (setq mark-active nil)
14382
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
502 (previous-line arg)
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
503 (setq this-command 'previous-line))
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
504
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
505 (defun beginning-of-line-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506 "Deactivate mark; move point to beginning of current line.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507 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
508 If scan reaches end of buffer, stop there without error."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 (beginning-of-line arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 (defun scroll-up-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 "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
515 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
516 Negative ARG means scroll downward.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 When calling from a program, supply a number as argument or nil."
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)
15931
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
520 (cond (pc-select-override-scroll-error
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
521 (condition-case nil (scroll-up arg)
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
522 (end-of-buffer (goto-char (point-max)))))
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
523 (t (scroll-up arg))))
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 (defun beginning-of-buffer-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526 "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
527 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
528
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 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
530 of the accessible part of the buffer.
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
531
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 Don't use this command in Lisp programs!
14382
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
533 \(goto-char (point-min)) is faster and avoids clobbering the mark."
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534 (interactive "P")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
535 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
536 (let ((size (- (point-max) (point-min))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
537 (goto-char (if arg
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538 (+ (point-min)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539 (if (> size 10000)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
540 ;; Avoid overflow for large buffer sizes!
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541 (* (prefix-numeric-value arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542 (/ size 10))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 (/ (+ 10 (* size (prefix-numeric-value arg))) 10)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544 (point-min))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 (if arg (forward-line 1)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546
13234
e3b1df16f4b4 (pc-selection-mode): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents: 13233
diff changeset
547 ;;;###autoload
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548 (defun pc-selection-mode ()
15907
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
549 "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
550
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
551 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
552
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
553 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
554 which modify the status of the mark.
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
555
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
556 The ordinary arrow keys disable the mark.
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
557 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
558
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
559 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
560 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
561
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
562 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
563 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
564
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
565 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
566 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
567 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
568
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
569 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
570 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
571 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
572
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
573 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
574 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
575
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
576 S-DELETE kills the region (`kill-region').
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
577 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
578 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
579
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
580 In addition, certain other PC bindings are imitated:
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
581
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
582 F6 other-window
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
583 DELETE delete-char
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
584 C-DELETE kill-line
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
585 M-DELETE kill-word
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
586 C-M-DELETE kill-sexp
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
587 C-BACKSPACE backward-kill-word
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
588 M-BACKSPACE undo"
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 (interactive)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
592 ;; keybindings
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
593 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595 ;; This is to avoid confusion with the delete-selection-mode
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
596 ;; On simple displays you can't see that a region is active and
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 ;; will be deleted on the next keypress. IMHO especially for
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
598 ;; copy-region-as-kill this is confusing
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
599 (define-key global-map "\M-w" 'copy-region-as-kill-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601
14040
187735b53d52 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 13476
diff changeset
602 ;; The following keybindings are for standard ISO keyboards
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
603 ;; as they are used with IBM compatible PCs, IBM RS/6000,
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
604 ;; MACs, many X-Stations and probably more
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
605 (define-key global-map [S-right] 'forward-char-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
606 (define-key global-map [right] 'forward-char-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
607 (define-key global-map [C-S-right] 'forward-word-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
608 (define-key global-map [C-right] 'forward-word-nomark)
14382
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
609 (define-key global-map [M-S-right] 'forward-word-mark)
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
610 (define-key global-map [M-right] 'forward-word-nomark)
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
611
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
612 (define-key global-map [S-down] 'next-line-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
613 (define-key global-map [down] 'next-line-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
614
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
615 (define-key global-map [S-end] 'end-of-line-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
616 (define-key global-map [end] 'end-of-line-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
617 (global-set-key [S-C-end] 'end-of-buffer-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
618 (global-set-key [C-end] 'end-of-buffer-nomark)
14382
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
619 (global-set-key [S-M-end] 'end-of-buffer-mark)
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
620 (global-set-key [M-end] 'end-of-buffer-nomark)
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
621
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
622 (define-key global-map [S-next] 'scroll-up-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
623 (define-key global-map [next] 'scroll-up-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
624
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
625 (define-key global-map [S-left] 'backward-char-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
626 (define-key global-map [left] 'backward-char-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
627 (define-key global-map [C-S-left] 'backward-word-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
628 (define-key global-map [C-left] 'backward-word-nomark)
14382
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
629 (define-key global-map [M-S-left] 'backward-word-mark)
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
630 (define-key global-map [M-left] 'backward-word-nomark)
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
631
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
632 (define-key global-map [S-up] 'previous-line-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
633 (define-key global-map [up] 'previous-line-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
634
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
635 (define-key global-map [S-home] 'beginning-of-line-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
636 (define-key global-map [home] 'beginning-of-line-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637 (global-set-key [S-C-home] 'beginning-of-buffer-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638 (global-set-key [C-home] 'beginning-of-buffer-nomark)
14382
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
639 (global-set-key [S-M-home] 'beginning-of-buffer-mark)
d74d8edde304 Add some keybindings.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
640 (global-set-key [M-home] 'beginning-of-buffer-nomark)
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642 (define-key global-map [S-prior] 'scroll-down-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 (define-key global-map [prior] 'scroll-down-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645 (define-key global-map [S-insert] 'yank)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
646 (define-key global-map [C-insert] 'copy-region-as-kill)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647 (define-key global-map [S-delete] 'kill-region)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648
15907
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
649 (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
650 (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
651 (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
652 (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
653
14040
187735b53d52 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 13476
diff changeset
654 ;; The following bindings are useful on Sun Type 3 keyboards
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655 ;; They implement the Get-Delete-Put (copy-cut-paste)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
656 ;; functions from sunview on the L6, L8 and L10 keys
17915
3c572d848dab (pc-selection-mode): Swap meanings of f16 and f18;
Richard M. Stallman <rms@gnu.org>
parents: 15931
diff changeset
657 ;; Sam Steingold <sds@ptc.com> says that f16 is copy and f18 is paste.
3c572d848dab (pc-selection-mode): Swap meanings of f16 and f18;
Richard M. Stallman <rms@gnu.org>
parents: 15931
diff changeset
658 (define-key global-map [f16] 'copy-region-as-kill)
3c572d848dab (pc-selection-mode): Swap meanings of f16 and f18;
Richard M. Stallman <rms@gnu.org>
parents: 15931
diff changeset
659 (define-key global-map [f18] 'yank)
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
660 (define-key global-map [f20] 'kill-region)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
661
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662 ;; The following bindings are from Pete Forman.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663 ;; I modified them a little to work together with the
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664 ;; mark functionality I added.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
665
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666 (global-set-key [f6] 'other-window) ; KNextPane F6
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667 (global-set-key [delete] 'delete-char) ; KDelete Del
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
668 (global-set-key [C-delete] 'kill-line) ; KEraseEndLine cDel
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669 (global-set-key [M-backspace] 'undo) ; KUndo aBS
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670 (global-set-key [C-down] 'forward-paragraph-nomark) ; KNextPara cDn
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671 (global-set-key [C-up] 'backward-paragraph-nomark) ; KPrevPara cUp
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672 (global-set-key [S-C-down] 'forward-paragraph-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673 (global-set-key [S-C-up] 'backward-paragraph-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 ;; The following bindings are taken from pc-mode.el
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
676 ;; as suggested by RMS.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
677 ;; I only used the ones that are not covered above.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
678 (define-key function-key-map [M-delete] [?\M-d])
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
679 (global-set-key [C-M-delete] 'kill-sexp)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
680 (global-set-key [C-backspace] 'backward-kill-word)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681 (global-set-key [C-escape] 'list-buffers)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
683 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 ;; setup
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686 (setq transient-mark-mode t)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 (setq mark-even-if-inactive t)
15907
c25492075289 Replace \n in doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 14734
diff changeset
688 (delete-selection-mode 1)
15931
c729af982039 (ensure-mark): Minor rewrite.
Richard M. Stallman <rms@gnu.org>
parents: 15907
diff changeset
689 )
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
690 ;;; pc-select.el ends here