annotate lisp/register.el @ 658:7cbd4fcd8b0f

*** empty log message ***
author Eric S. Raymond <esr@snark.thyrsus.com>
date Sat, 30 May 1992 21:11:25 +0000
parents 6155e428f077
children c2dbf1fe0506
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 243
diff changeset
1 ;;; register.el --- register commands for Emacs.
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 243
diff changeset
2
47
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1985 Free Software Foundation, Inc.
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; This file is part of GNU Emacs.
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; GNU Emacs is free software; you can redistribute it and/or modify
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; it under the terms of the GNU General Public License as published by
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; the Free Software Foundation; either version 1, or (at your option)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; any later version.
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; GNU Emacs is distributed in the hope that it will be useful,
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; GNU General Public License for more details.
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; You should have received a copy of the GNU General Public License
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; along with GNU Emacs; see the file COPYING. If not, write to
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 (defvar register-alist nil
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 "Alist of elements (NAME . CONTENTS), one for each Emacs register.
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 NAME is a character (a number). CONTENTS is a string, number,
141
405b4fa6de27 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 72
diff changeset
25 screen configuration, mark or list.
405b4fa6de27 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 72
diff changeset
26 A list represents a rectangle; its elements are strings.")
47
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 (defun get-register (char)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 "Return contents of Emacs register named CHAR, or nil if none."
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 (cdr (assq char register-alist)))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 (defun set-register (char value)
243
6155e428f077 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 151
diff changeset
33 "Set contents of Emacs register named CHAR to VALUE. Returns VALUE."
47
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 (let ((aelt (assq char register-alist)))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 (if aelt
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 (setcdr aelt value)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 (setq aelt (cons char value))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 (setq register-alist (cons aelt register-alist)))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 value))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40
141
405b4fa6de27 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 72
diff changeset
41 (defun point-to-register (char arg)
405b4fa6de27 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 72
diff changeset
42 "Store current location of point in register REGISTER.
405b4fa6de27 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 72
diff changeset
43 With prefix argument, store current screen configuration.
405b4fa6de27 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 72
diff changeset
44 Use \\[jump-to-register] to go to that location or restore that configuration.
47
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 Argument is a character, naming the register."
141
405b4fa6de27 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 72
diff changeset
46 (interactive "cPoint to register: \nP")
405b4fa6de27 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 72
diff changeset
47 (set-register char (if arg (current-screen-configuration) (point-marker))))
47
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 (fset 'register-to-point 'jump-to-register)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 (defun jump-to-register (char)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 "Move point to location stored in a register.
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 Argument is a character, naming the register."
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 (interactive "cJump to register: ")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 (let ((val (get-register char)))
141
405b4fa6de27 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 72
diff changeset
55 (condition-case ()
405b4fa6de27 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 72
diff changeset
56 (set-screen-configuration val)
405b4fa6de27 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 72
diff changeset
57 (error
405b4fa6de27 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 72
diff changeset
58 (if (markerp val)
405b4fa6de27 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 72
diff changeset
59 (progn
405b4fa6de27 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 72
diff changeset
60 (switch-to-buffer (marker-buffer val))
405b4fa6de27 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 72
diff changeset
61 (goto-char val))
151
cca4fc067605 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 141
diff changeset
62 (error "Register doesn't contain a buffer position or screen configuration"))))))
47
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ;(defun number-to-register (arg char)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 ; "Store a number in a register.
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 ;Two args, NUMBER and REGISTER (a character, naming the register).
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 ;If NUMBER is nil, digits in the buffer following point are read
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 ;to get the number to store.
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 ;Interactively, NUMBER is the prefix arg (none means nil)."
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 ; (interactive "P\ncNumber to register: ")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ; (set-register char
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ; (if arg
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ; (prefix-numeric-value arg)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 ; (if (looking-at "[0-9][0-9]*")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 ; (save-excursion
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 ; (save-restriction
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 ; (narrow-to-region (point)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 ; (progn (skip-chars-forward "0-9")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 ; (point)))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 ; (goto-char (point-min))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 ; (read (current-buffer))))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 ; 0))))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 ;(defun increment-register (arg char)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 ; "Add NUMBER to the contents of register REGISTER.
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 ;Interactively, NUMBER is the prefix arg (none means nil)."
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 ; (interactive "p\ncNumber to register: ")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 ; (or (integerp (get-register char))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 ; (error "Register does not contain a number"))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 ; (set-register char (+ arg (get-register char))))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 (defun view-register (char)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 "Display what is contained in register named REGISTER.
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 REGISTER is a character."
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 (interactive "cView register: ")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 (let ((val (get-register char)))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 (if (null val)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 (message "Register %s is empty" (single-key-description char))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 (with-output-to-temp-buffer "*Output*"
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 (princ "Register ")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 (princ (single-key-description char))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 (princ " contains ")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 (if (integerp val)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 (princ val)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 (if (markerp val)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 (progn
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 (princ "a buffer position:\nbuffer ")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 (princ (buffer-name (marker-buffer val)))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (princ ", position ")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 (princ (+ 0 val)))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (if (consp val)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 (progn
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (princ "the rectangle:\n")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (while val
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 (princ (car val))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 (terpri)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 (setq val (cdr val))))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (princ "the string:\n")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 (princ val))))))))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 (defun insert-register (char &optional arg)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 "Insert contents of register REG. REG is a character.
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 Normally puts point before and mark after the inserted text.
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 If optional second arg is non-nil, puts mark before and point after.
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 Interactively, second arg is non-nil if prefix arg is supplied."
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 (interactive "cInsert register: \nP")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (push-mark)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 (let ((val (get-register char)))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 (if (consp val)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (insert-rectangle val)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (if (stringp val)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 (insert val)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 (if (or (integerp val) (markerp val))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 (princ (+ 0 val) (current-buffer))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 (error "Register does not contain text")))))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 (if (not arg) (exchange-point-and-mark)))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 (defun copy-to-register (char start end &optional delete-flag)
243
6155e428f077 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 151
diff changeset
139 "Copy region into register REG. With prefix arg, delete as well.
6155e428f077 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 151
diff changeset
140 Called from program, takes four args: REG, START, END and DELETE-FLAG.
47
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 START and END are buffer positions indicating what to copy."
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 (interactive "cCopy to register: \nr\nP")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 (set-register char (buffer-substring start end))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 (if delete-flag (delete-region start end)))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 (defun append-to-register (char start end &optional delete-flag)
243
6155e428f077 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 151
diff changeset
147 "Append region to text in register REG. With prefix arg, delete as well.
6155e428f077 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 151
diff changeset
148 Called from program, takes four args: REG, START, END and DELETE-FLAG.
47
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 START and END are buffer positions indicating what to append."
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 (interactive "cAppend to register: \nr\nP")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 (or (stringp (get-register char))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 (error "Register does not contain text"))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 (set-register char (concat (get-register char)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 (buffer-substring start end)))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 (if delete-flag (delete-region start end)))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 (defun prepend-to-register (char start end &optional delete-flag)
243
6155e428f077 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 151
diff changeset
158 "Prepend region to text in register REG. With prefix arg, delete as well.
6155e428f077 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 151
diff changeset
159 Called from program, takes four args: REG, START, END and DELETE-FLAG.
47
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 START and END are buffer positions indicating what to prepend."
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 (interactive "cPrepend to register: \nr\nP")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 (or (stringp (get-register char))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 (error "Register does not contain text"))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 (set-register char (concat (buffer-substring start end)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 (get-register char)))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 (if delete-flag (delete-region start end)))
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 (defun copy-rectangle-to-register (char start end &optional delete-flag)
243
6155e428f077 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 151
diff changeset
169 "Copy rectangular region into register REG. With prefix arg, delete as well.
6155e428f077 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 151
diff changeset
170 Called from program, takes four args: REG, START, END and DELETE-FLAG.
47
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 START and END are buffer positions giving two corners of rectangle."
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 (interactive "cCopy rectangle to register: \nr\nP")
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 (set-register char
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 (if delete-flag
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 (delete-extract-rectangle start end)
dfec464ac265 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 (extract-rectangle start end))))
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 243
diff changeset
177
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 243
diff changeset
178 ;;; register.el ends here