annotate lisp/emulation/pc-select.el @ 14018:0a94cd2c51c4

Comment fixes.
author Karl Heuer <kwzh@gnu.org>
date Fri, 05 Jan 1996 00:45:43 +0000
parents 23173d03180b
children 187735b53d52
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
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Copyright (C) 1995 Free Software Foundation, Inc.
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
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; 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
29 ;; 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
30 ;; It modifies the keybindings of the cursor keys and the next, prior,
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;; home and end keys. They will modify mark-active.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; You can still get the old behaviour of cursor moving with the
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; control sequences C-f, C-b, etc.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;; This package uses transient-mark-mode and
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; delete-selection-mode.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; In addition to that all key-bindings from the pc-mode are
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; done here too (as suggested by RMS).
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;; 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
41 ;; 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
42 ;; delete-selection-mode is very important for the look-and-feel.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;; Pete Forman <pete.forman@airgun.wg.waii.com> provided some motif
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; compliant keybindings which I added. I had to modify them a little
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; to add the -mark and -nomark functionality of cursor moving.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;; Credits:
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; Many thanks to all who made comments.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ;; 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
50 ;; Kevin Cutts <cutts@ukraine.corp.mot.com> added the beginning-of-buffer
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ;; and end-of-buffer functions which I modified a little.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;; David Biesack <sasdjb@unx.sas.com> suggested some more cleanup.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 ;; Thanks to Pete Forman <pete.forman@airgun.wg.waii.com>
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 ;; for additional motif keybindings.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 ;; Ok, some details about the idea of pc-selection-mode:
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 ;; 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
60 ;; prior, next, called "move-keys" from now on) will always de-activate
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 ;; the mark.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 ;; o If you press "Shift" together with the "move-keys", the region
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 ;; you pass along is activated
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ;; 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
65 ;; which will operate on the active region
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 ;; 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
67 ;; emacs reasons.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 ;; 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
69 ;; 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
70 ;; other programs.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 ;;;; INSTALLATION:
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 ;;;; o Put this file called "pc-select.el" into a path where emacs
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 ;;;; looks for lisp libraries. Byte-compile if you want to.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 ;;;; o Put the command '(require 'pc-select) or
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 ;;;; '(load "pc-select")' into your ~/.emacs. After that line
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 ;;;; put the command '(pc-selection-mode)' to activate the mode.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 ;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 ;;;; Please note that I am _not_ a lisp expert, I apologise for
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 ;;;; all hacks which look ugly to an experienced lisp programmer.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 ;;;; Please report all errors and improvement. Thank you.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 ;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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 ;;;; Code:
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88
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 ;; misc
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 ;;;;
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 (provide 'pc-select)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 (defun copy-region-as-kill-nomark (beg end)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 "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
97 If `interprogram-cut-function' is non-nil, also save the text for a window
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 system cut and paste.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 Deactivating mark is to avoid confusion with delete-selection-mode
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 and transient-mark-mode."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 (interactive "r")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 (copy-region-as-kill beg end)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 (message "Region saved"))
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 ;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 ;; non-interactive
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 ;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (defun ensure-mark()
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 ;; make sure mark is active
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 ;; test if it is active, if it isn't, set it and activate it
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 (and (not mark-active) (set-mark-command nil)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 ;;;;; forward and mark
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
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (defun forward-char-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 "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
120 On reaching end of buffer, stop and signal error."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 (forward-char arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 (defun forward-word-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 "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
127 Normally returns t.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 If an edge of the buffer is reached, point is left there
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 and nil is returned."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 (forward-word arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 (defun forward-paragraph-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 "Ensure mark is active; move forward to end of paragraph.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 With arg N, do it N times; negative arg -N means move backward N paragraphs.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 A line which `paragraph-start' matches either separates paragraphs
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 (if `paragraph-separate' matches it also) or is the first line of a paragraph.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 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
140 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
141 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 (forward-paragraph arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 (defun next-line-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 "Ensure mark is active; move cursor vertically down ARG lines.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 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
148 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
149 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
150 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
151 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
152 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
153 cursor to the end of the buffer \(if already at the end of the buffer, an error
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 is signaled).\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 The command C-x C-n can be used to create
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 a semipermanent goal column to which this command always moves.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 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
158 in `goal-column', which is nil when there is none."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 (next-line arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 (defun end-of-line-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 "Ensure mark is active; move point to end of current line.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 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
166 If scan reaches end of buffer, stop there without error."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 (end-of-line arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 (defun scroll-down-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 "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
173 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
174 Negative ARG means scroll upward.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 When calling from a program, supply a number as argument or nil."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 (interactive "P")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 (scroll-down arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 (defun end-of-buffer-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 "Ensure mark is active; move point to the end of the buffer.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 With arg N, put point N/10 of the way from the end.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 If the buffer is narrowed, this command uses the beginning and size
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 of the accessible part of the buffer.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 Don't use this command in Lisp programs!
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 \(goto-char \(point-max)) is faster and avoids clobbering the mark."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 (interactive "P")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 (let ((size (- (point-max) (point-min))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 (goto-char (if arg
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 (- (point-max)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 (if (> size 10000)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 ;; Avoid overflow for large buffer sizes!
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 (* (prefix-numeric-value arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 (/ size 10))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 (/ (* size (prefix-numeric-value arg)) 10)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 (point-max))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 ;; If we went to a place in the middle of the buffer,
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 ;; adjust it to the beginning of a line.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 (if arg (forward-line 1)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 ;; If the end of the buffer is not already on the screen,
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 ;; then scroll specially to put it near, but not at, the bottom.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 (if (let ((old-point (point)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 (save-excursion
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 (goto-char (window-start))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 (vertical-motion (window-height))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 (< (point) old-point)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 (progn
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 (overlay-recenter (point))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 (recenter -3)))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 ;;;;;;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 ;;;;; no mark
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 ;;;;;;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 (defun forward-char-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 "Deactivate mark; move point right ARG characters \(left if ARG negative).
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 On reaching end of buffer, stop and signal error."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 (forward-char arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 (defun forward-word-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 "Deactivate mark; move point right ARG words \(backward if ARG is negative).
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 Normally returns t.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 If an edge of the buffer is reached, point is left there
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 and nil is returned."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 (forward-word arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 (defun forward-paragraph-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 "Deactivate mark; move forward to end of paragraph.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 With arg N, do it N times; negative arg -N means move backward N paragraphs.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 A line which `paragraph-start' matches either separates paragraphs
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 (if `paragraph-separate' matches it also) or is the first line of a paragraph.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 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
238 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
239 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 (forward-paragraph arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 (defun next-line-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 "Deactivate mark; move cursor vertically down ARG lines.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 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
246 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
247 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
248 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
249 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
250 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
251 cursor to the end of the buffer (if already at the end of the buffer, an error
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 is signaled).\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 The command C-x C-n can be used to create
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 a semipermanent goal column to which this command always moves.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 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
256 in `goal-column', which is nil when there is none."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 (next-line arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 (defun end-of-line-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 "Deactivate mark; move point to end of current line.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 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
264 If scan reaches end of buffer, stop there without error."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 (end-of-line arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 (defun scroll-down-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 "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
271 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
272 Negative ARG means scroll upward.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 When calling from a program, supply a number as argument or nil."
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 (scroll-down 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 end-of-buffer-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 "Deactivate mark; move point to the end of the buffer.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 With arg N, put point N/10 of the way from the end.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 If the buffer is narrowed, this command uses the beginning and size
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 of the accessible part of the buffer.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 Don't use this command in Lisp programs!
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 (goto-char (point-max)) is faster and avoids clobbering the mark."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 (interactive "P")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 (let ((size (- (point-max) (point-min))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 (goto-char (if arg
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 (- (point-max)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 (if (> size 10000)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 ;; Avoid overflow for large buffer sizes!
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 (* (prefix-numeric-value arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 (/ size 10))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 (/ (* size (prefix-numeric-value arg)) 10)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 (point-max))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296 ;; If we went to a place in the middle of the buffer,
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 ;; adjust it to the beginning of a line.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298 (if arg (forward-line 1)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 ;; If the end of the buffer is not already on the screen,
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 ;; then scroll specially to put it near, but not at, the bottom.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 (if (let ((old-point (point)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 (save-excursion
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 (goto-char (window-start))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 (vertical-motion (window-height))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 (< (point) old-point)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 (progn
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 (overlay-recenter (point))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 (recenter -3)))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 ;;;;;;;;;;;;;;;;;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 ;;;;;; backwards and mark
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 ;;;;;;;;;;;;;;;;;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 (defun backward-char-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 "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
317 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
318 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320 (backward-char arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 (defun backward-word-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 "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
324 With argument, do this that many times."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327 (backward-word arg))
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 backward-paragraph-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 "Ensure mark is active; move backward to start of paragraph.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331 With arg N, do it N times; negative arg -N means move forward N paragraphs.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332 A paragraph start is the beginning of a line which is a
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333 `first-line-of-paragraph' or which is ordinary text and follows a
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334 paragraph-separating line; except: if the first real line of a
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
335 paragraph is preceded by a blank line, the paragraph starts at that
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336 blank line.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337 See `forward-paragraph' for more information."
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 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 (backward-paragraph arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 (defun previous-line-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 "Ensure mark is active; move cursor vertically up ARG lines.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 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
345 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
346 column, or at the end of the line if it is not long enough.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 The command C-x C-n can be used to create
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 a semipermanent goal column to which this command always moves.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349 Then it does not try to move vertically.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 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
351 `forward-line' with a negative argument instead. It is usually easier
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 to use and more reliable (no dependence on goal column, etc.)."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 (previous-line arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357 (defun beginning-of-line-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 "Ensure mark is active; move point to beginning of current line.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 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
360 If scan reaches end of buffer, stop there without error."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363 (beginning-of-line arg))
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
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366 (defun scroll-up-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 "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
368 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
369 Negative ARG means scroll downward.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370 When calling from a program, supply a number as argument or nil."
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 (scroll-up 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 beginning-of-buffer-mark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376 "Ensure mark is active; move point to the beginning of the buffer.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377 With arg N, put point N/10 of the way from the beginning.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 If the buffer is narrowed, this command uses the beginning and size
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 of the accessible part of the buffer.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 Don't use this command in Lisp programs!
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381 \(goto-char (p\oint-min)) is faster and avoids clobbering the mark."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 (interactive "P")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 (ensure-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384 (let ((size (- (point-max) (point-min))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385 (goto-char (if arg
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 (+ (point-min)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387 (if (> size 10000)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 ;; Avoid overflow for large buffer sizes!
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389 (* (prefix-numeric-value arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 (/ size 10))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391 (/ (+ 10 (* size (prefix-numeric-value arg))) 10)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392 (point-min))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393 (if arg (forward-line 1)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
394
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395 ;;;;;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396 ;;; no mark
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 ;;;;;;;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399 (defun backward-char-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 "Deactivate mark; move point left ARG characters (right if ARG negative).
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401 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
402 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 (backward-char arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 (defun backward-word-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 "Deactivate mark; move backward until encountering the end of a word.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408 With argument, do this that many times."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 (backward-word arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413 (defun backward-paragraph-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414 "Deactivate mark; move backward to start of paragraph.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
415 With arg N, do it N times; negative arg -N means move forward N paragraphs.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416 A paragraph start is the beginning of a line which is a
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 `first-line-of-paragraph' or which is ordinary text and follows a
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 paragraph-separating line; except: if the first real line of a
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 paragraph is preceded by a blank line, the paragraph starts at that
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420 blank line.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421 See `forward-paragraph' for more information."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 (backward-paragraph arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
426 (defun previous-line-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427 "Deactivate mark; move cursor vertically up ARG lines.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428 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
429 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
430 column, or at the end of the line if it is not long enough.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 The command C-x C-n can be used to create
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432 a semipermanent goal column to which this command always moves.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
433 Then it does not try to move vertically."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
434 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436 (previous-line arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438 (defun beginning-of-line-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439 "Deactivate mark; move point to beginning of current line.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
440 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
441 If scan reaches end of buffer, stop there without error."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442 (interactive "p")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
444 (beginning-of-line arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 (defun scroll-up-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447 "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
448 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
449 Negative ARG means scroll downward.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
450 When calling from a program, supply a number as argument or nil."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 (interactive "P")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453 (scroll-up arg))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 (defun beginning-of-buffer-nomark (&optional arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 "Deactivate mark; move point to the beginning of the buffer.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457 With arg N, put point N/10 of the way from the beginning.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 If the buffer is narrowed, this command uses the beginning and size
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 of the accessible part of the buffer.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 Don't use this command in Lisp programs!
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 (goto-char (point-min)) is faster and avoids clobbering the mark."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 (interactive "P")
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 (setq mark-active nil)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 (let ((size (- (point-max) (point-min))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 (goto-char (if arg
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466 (+ (point-min)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 (if (> size 10000)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 ;; Avoid overflow for large buffer sizes!
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 (* (prefix-numeric-value arg)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 (/ size 10))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 (/ (+ 10 (* size (prefix-numeric-value arg))) 10)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472 (point-min))))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473 (if arg (forward-line 1)))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474
13234
e3b1df16f4b4 (pc-selection-mode): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents: 13233
diff changeset
475 ;;;###autoload
13233
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476 (defun pc-selection-mode ()
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
477 "Change mark behaviour to emulate motif, MAC or MS-Windows cut and paste style.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478 This mode will switch on delete-selection-mode and
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479 transient-mark-mode.\n
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
480 The cursor keys (and others) are bound to new functions
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481 which will modify the status of the mark. It will be
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 possible to select regions with shift-cursorkeys. All this
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 tries to emulate the look-and-feel of GUIs like motif,
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484 the MAC GUI or MS-Windows (sorry for the last one)."
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485 (interactive)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487 ;; keybindings
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490 ;; This is to avoid confusion with the delete-selection-mode
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491 ;; 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
492 ;; will be deleted on the next keypress. IMHO especially for
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493 ;; copy-region-as-kill this is confusing
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 (define-key global-map "\M-w" 'copy-region-as-kill-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 ;; The followong keybindings are for standard ISO keyboards
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 ;; as they are used with IBM compatible PCs, IBM RS/6000,
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 ;; MACs, many X-Stations and probably more
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500 (define-key global-map [S-right] 'forward-char-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501 (define-key global-map [right] 'forward-char-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 (define-key global-map [C-S-right] 'forward-word-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
503 (define-key global-map [C-right] 'forward-word-nomark)
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 (define-key global-map [S-down] 'next-line-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506 (define-key global-map [down] 'next-line-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 (define-key global-map [S-end] 'end-of-line-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 (define-key global-map [end] 'end-of-line-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 (global-set-key [S-C-end] 'end-of-buffer-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 (global-set-key [C-end] 'end-of-buffer-nomark)
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 (define-key global-map [S-next] 'scroll-up-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 (define-key global-map [next] 'scroll-up-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 (define-key global-map [S-left] 'backward-char-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 (define-key global-map [left] 'backward-char-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518 (define-key global-map [C-S-left] 'backward-word-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 (define-key global-map [C-left] 'backward-word-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521 (define-key global-map [S-up] 'previous-line-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 (define-key global-map [up] 'previous-line-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 (define-key global-map [S-home] 'beginning-of-line-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 (define-key global-map [home] 'beginning-of-line-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526 (global-set-key [S-C-home] 'beginning-of-buffer-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
527 (global-set-key [C-home] 'beginning-of-buffer-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 (define-key global-map [S-prior] 'scroll-down-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530 (define-key global-map [prior] 'scroll-down-nomark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
531
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 (define-key global-map [S-insert] 'yank)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
533 (define-key global-map [C-insert] 'copy-region-as-kill)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534 (define-key global-map [S-delete] 'kill-region)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
535
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
536 ;; The following bindings are usueful on Sun Type 3 keyboards
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
537 ;; They implement the Get-Delete-Put (copy-cut-paste)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538 ;; functions from sunview on the L6, L8 and L10 keys
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539 (define-key global-map [f16] 'yank)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
540 (define-key global-map [f18] 'copy-region-as-kill)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541 (define-key global-map [f20] 'kill-region)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 ;; The following bindings are from Pete Forman.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544 ;; I modified them a little to work together with the
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 ;; mark functionality I added.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547 (global-set-key [f1] 'help) ; KHelp F1
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548 (global-set-key [f6] 'other-window) ; KNextPane F6
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 (global-set-key [delete] 'delete-char) ; KDelete Del
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550 (global-set-key [C-delete] 'kill-line) ; KEraseEndLine cDel
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 (global-set-key [M-backspace] 'undo) ; KUndo aBS
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 (global-set-key [C-down] 'forward-paragraph-nomark) ; KNextPara cDn
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 (global-set-key [C-up] 'backward-paragraph-nomark) ; KPrevPara cUp
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 (global-set-key [S-C-down] 'forward-paragraph-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 (global-set-key [S-C-up] 'backward-paragraph-mark)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 ;; The following bindings are taken from pc-mode.el
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558 ;; as suggested by RMS.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559 ;; I only used the ones that are not covered above.
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 (define-key function-key-map [M-delete] [?\M-d])
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 (global-set-key [C-M-delete] 'kill-sexp)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562 (global-set-key [C-backspace] 'backward-kill-word)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563 (global-set-key [C-escape] 'list-buffers)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 ;; setup
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 ;;
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568 (setq transient-mark-mode t)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569 (setq mark-even-if-inactive t)
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570 (delete-selection-mode 1))
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571
8b29f638af52 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 ;;; pc-select.el ends here