annotate lisp/rect.el @ 112437:f3d875901372

Merge from mainline.
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 22 Jan 2011 20:30:57 -0800
parents ef719132ddfa
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37444
diff changeset
1 ;;; rect.el --- rectangle functions for GNU Emacs
659
505130d1ddf8 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 258
diff changeset
2
64762
41bb365f41c4 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64091
diff changeset
3 ;; Copyright (C) 1985, 1999, 2000, 2001, 2002, 2003, 2004
112218
376148b31b5e Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
4 ;; 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
845
213978acbc1e entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
5
39537
133fc59b5c6a Update maintainer's email address.
Eli Zaretskii <eliz@gnu.org>
parents: 38436
diff changeset
6 ;; Maintainer: Didier Verna <didier@xemacs.org>
814
38b2499cb3e9 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
7 ;; Keywords: internal
110015
280c8ae2476d Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
8 ;; Package: emacs
789
71d052f72ac1 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 659
diff changeset
9
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
11
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
15 ;; (at your option) any later version.
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
16
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
21
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
24
2308
f287613dfc28 Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1619
diff changeset
25 ;;; Commentary:
f287613dfc28 Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1619
diff changeset
26
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
27 ;; This package provides the operations on rectangles that are documented
2308
f287613dfc28 Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1619
diff changeset
28 ;; in the Emacs manual.
f287613dfc28 Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1619
diff changeset
29
111969
0889087d741a Delete long unused functions and variables in rect.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110015
diff changeset
30 ;; ### NOTE: this file was almost completely rewritten by Didier Verna
0889087d741a Delete long unused functions and variables in rect.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110015
diff changeset
31 ;; <didier@xemacs.org> in July 1999.
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
32
96440
4dbdccc0a028 Bind global keys to ctl-x-r-map in autoload cookies.
Juri Linkov <juri@jurta.org>
parents: 94678
diff changeset
33 ;;; Global key bindings
4dbdccc0a028 Bind global keys to ctl-x-r-map in autoload cookies.
Juri Linkov <juri@jurta.org>
parents: 94678
diff changeset
34
4dbdccc0a028 Bind global keys to ctl-x-r-map in autoload cookies.
Juri Linkov <juri@jurta.org>
parents: 94678
diff changeset
35 ;;;###autoload (define-key ctl-x-r-map "c" 'clear-rectangle)
4dbdccc0a028 Bind global keys to ctl-x-r-map in autoload cookies.
Juri Linkov <juri@jurta.org>
parents: 94678
diff changeset
36 ;;;###autoload (define-key ctl-x-r-map "k" 'kill-rectangle)
4dbdccc0a028 Bind global keys to ctl-x-r-map in autoload cookies.
Juri Linkov <juri@jurta.org>
parents: 94678
diff changeset
37 ;;;###autoload (define-key ctl-x-r-map "d" 'delete-rectangle)
4dbdccc0a028 Bind global keys to ctl-x-r-map in autoload cookies.
Juri Linkov <juri@jurta.org>
parents: 94678
diff changeset
38 ;;;###autoload (define-key ctl-x-r-map "y" 'yank-rectangle)
4dbdccc0a028 Bind global keys to ctl-x-r-map in autoload cookies.
Juri Linkov <juri@jurta.org>
parents: 94678
diff changeset
39 ;;;###autoload (define-key ctl-x-r-map "o" 'open-rectangle)
4dbdccc0a028 Bind global keys to ctl-x-r-map in autoload cookies.
Juri Linkov <juri@jurta.org>
parents: 94678
diff changeset
40 ;;;###autoload (define-key ctl-x-r-map "t" 'string-rectangle)
111970
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
41 ;;;###autoload (define-key ctl-x-r-map "N" 'rectangle-number-lines)
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
42
789
71d052f72ac1 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 659
diff changeset
43 ;;; Code:
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
44
111969
0889087d741a Delete long unused functions and variables in rect.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110015
diff changeset
45 ;; FIXME: this function should be replaced by `apply-on-rectangle'
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
46 (defun operate-on-rectangle (function start end coerce-tabs)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
47 "Call FUNCTION for each line of rectangle with corners at START, END.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
48 If COERCE-TABS is non-nil, convert multi-column characters
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
49 that span the starting or ending columns on any line
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
50 to multiple spaces before calling FUNCTION.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
51 FUNCTION is called with three arguments:
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
52 position of start of segment of this line within the rectangle,
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
53 number of columns that belong to rectangle but are before that position,
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
54 number of columns that belong to rectangle but are after point.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
55 Point is at the end of the segment of this line within the rectangle."
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
56 (let (startcol startlinepos endcol endlinepos)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
57 (save-excursion
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
58 (goto-char start)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
59 (setq startcol (current-column))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
60 (beginning-of-line)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
61 (setq startlinepos (point)))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
62 (save-excursion
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
63 (goto-char end)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
64 (setq endcol (current-column))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
65 (forward-line 1)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
66 (setq endlinepos (point-marker)))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
67 (if (< endcol startcol)
1619
6147d2164331 * rect.el (operate-on-rectangle): Use move-to-column's FORCE
Jim Blandy <jimb@redhat.com>
parents: 1542
diff changeset
68 (setq startcol (prog1 endcol (setq endcol startcol))))
5787
bef3a67ac893 (string-rectangle): Make operate-on-rectangle convert tabs.
Richard M. Stallman <rms@gnu.org>
parents: 2637
diff changeset
69 (save-excursion
bef3a67ac893 (string-rectangle): Make operate-on-rectangle convert tabs.
Richard M. Stallman <rms@gnu.org>
parents: 2637
diff changeset
70 (goto-char startlinepos)
bef3a67ac893 (string-rectangle): Make operate-on-rectangle convert tabs.
Richard M. Stallman <rms@gnu.org>
parents: 2637
diff changeset
71 (while (< (point) endlinepos)
bef3a67ac893 (string-rectangle): Make operate-on-rectangle convert tabs.
Richard M. Stallman <rms@gnu.org>
parents: 2637
diff changeset
72 (let (startpos begextra endextra)
23757
717a33da04a1 (move-to-column-force): New function.
Kenichi Handa <handa@m17n.org>
parents: 23641
diff changeset
73 (if coerce-tabs
41173
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
74 (move-to-column startcol t)
23757
717a33da04a1 (move-to-column-force): New function.
Kenichi Handa <handa@m17n.org>
parents: 23641
diff changeset
75 (move-to-column startcol))
5787
bef3a67ac893 (string-rectangle): Make operate-on-rectangle convert tabs.
Richard M. Stallman <rms@gnu.org>
parents: 2637
diff changeset
76 (setq begextra (- (current-column) startcol))
bef3a67ac893 (string-rectangle): Make operate-on-rectangle convert tabs.
Richard M. Stallman <rms@gnu.org>
parents: 2637
diff changeset
77 (setq startpos (point))
23757
717a33da04a1 (move-to-column-force): New function.
Kenichi Handa <handa@m17n.org>
parents: 23641
diff changeset
78 (if coerce-tabs
41173
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
79 (move-to-column endcol t)
23757
717a33da04a1 (move-to-column-force): New function.
Kenichi Handa <handa@m17n.org>
parents: 23641
diff changeset
80 (move-to-column endcol))
19732
d8478556c7f0 (operate-on-rectangle): If we overshoot when looking for endcol, back up.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
81 ;; If we overshot, move back one character
d8478556c7f0 (operate-on-rectangle): If we overshoot when looking for endcol, back up.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
82 ;; so that endextra will be positive.
d8478556c7f0 (operate-on-rectangle): If we overshoot when looking for endcol, back up.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
83 (if (and (not coerce-tabs) (> (current-column) endcol))
d8478556c7f0 (operate-on-rectangle): If we overshoot when looking for endcol, back up.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
84 (backward-char 1))
5787
bef3a67ac893 (string-rectangle): Make operate-on-rectangle convert tabs.
Richard M. Stallman <rms@gnu.org>
parents: 2637
diff changeset
85 (setq endextra (- endcol (current-column)))
bef3a67ac893 (string-rectangle): Make operate-on-rectangle convert tabs.
Richard M. Stallman <rms@gnu.org>
parents: 2637
diff changeset
86 (if (< begextra 0)
bef3a67ac893 (string-rectangle): Make operate-on-rectangle convert tabs.
Richard M. Stallman <rms@gnu.org>
parents: 2637
diff changeset
87 (setq endextra (+ endextra begextra)
bef3a67ac893 (string-rectangle): Make operate-on-rectangle convert tabs.
Richard M. Stallman <rms@gnu.org>
parents: 2637
diff changeset
88 begextra 0))
bef3a67ac893 (string-rectangle): Make operate-on-rectangle convert tabs.
Richard M. Stallman <rms@gnu.org>
parents: 2637
diff changeset
89 (funcall function startpos begextra endextra))
bef3a67ac893 (string-rectangle): Make operate-on-rectangle convert tabs.
Richard M. Stallman <rms@gnu.org>
parents: 2637
diff changeset
90 (forward-line 1)))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
91 (- endcol startcol)))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
92
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
93 (defun apply-on-rectangle (function start end &rest args)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
94 "Call FUNCTION for each line of rectangle with corners at START, END.
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
95 FUNCTION is called with two arguments: the start and end columns of the
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
96 rectangle, plus ARGS extra arguments. Point is at the beginning of line when
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
97 the function is called."
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
98 (let (startcol startpt endcol endpt)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
99 (save-excursion
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
100 (goto-char start)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
101 (setq startcol (current-column))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
102 (beginning-of-line)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
103 (setq startpt (point))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
104 (goto-char end)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
105 (setq endcol (current-column))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
106 (forward-line 1)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
107 (setq endpt (point-marker))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
108 ;; ensure the start column is the left one.
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
109 (if (< endcol startcol)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
110 (let ((col startcol))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
111 (setq startcol endcol endcol col)))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
112 ;; start looping over lines
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
113 (goto-char startpt)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
114 (while (< (point) endpt)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
115 (apply function startcol endcol args)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
116 (forward-line 1)))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
117 ))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
118
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
119 (defun delete-rectangle-line (startcol endcol fill)
59783
b2ab001718c6 (delete-rectangle-line, delete-extract-rectangle-line)
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
120 (when (= (move-to-column startcol (if fill t 'coerce)) startcol)
41173
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
121 (delete-region (point)
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
122 (progn (move-to-column endcol 'coerce)
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
123 (point)))))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
124
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
125 (defun delete-extract-rectangle-line (startcol endcol lines fill)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
126 (let ((pt (point-at-eol)))
59783
b2ab001718c6 (delete-rectangle-line, delete-extract-rectangle-line)
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
127 (if (< (move-to-column startcol (if fill t 'coerce)) startcol)
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
128 (setcdr lines (cons (spaces-string (- endcol startcol))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
129 (cdr lines)))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
130 ;; else
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
131 (setq pt (point))
41173
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
132 (move-to-column endcol t)
69862
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
133 (setcdr lines (cons (filter-buffer-substring pt (point) t) (cdr lines))))
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
134 ))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
135
111969
0889087d741a Delete long unused functions and variables in rect.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110015
diff changeset
136 ;; This is actually the only function that needs to do complicated
0889087d741a Delete long unused functions and variables in rect.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110015
diff changeset
137 ;; stuff like what's happening in `operate-on-rectangle', because the
0889087d741a Delete long unused functions and variables in rect.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 110015
diff changeset
138 ;; buffer might be read-only.
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
139 (defun extract-rectangle-line (startcol endcol lines)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
140 (let (start end begextra endextra line)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
141 (move-to-column startcol)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
142 (setq start (point)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
143 begextra (- (current-column) startcol))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
144 (move-to-column endcol)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
145 (setq end (point)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
146 endextra (- endcol (current-column)))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
147 (setq line (buffer-substring start (point)))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
148 (if (< begextra 0)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
149 (setq endextra (+ endextra begextra)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
150 begextra 0))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
151 (if (< endextra 0)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
152 (setq endextra 0))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
153 (goto-char start)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
154 (while (search-forward "\t" end t)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
155 (let ((width (- (current-column)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
156 (save-excursion (forward-char -1)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
157 (current-column)))))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
158 (setq line (concat (substring line 0 (- (point) end 1))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
159 (spaces-string width)
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
160 (substring line (+ (length line)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
161 (- (point) end)))))))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
162 (if (or (> begextra 0) (> endextra 0))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
163 (setq line (concat (spaces-string begextra)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
164 line
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
165 (spaces-string endextra))))
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
166 (setcdr lines (cons line (cdr lines)))))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
167
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
168 (defconst spaces-strings
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
169 '["" " " " " " " " " " " " " " " " "])
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
170
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
171 (defun spaces-string (n)
99298
225286546090 Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 96440
diff changeset
172 "Return a string with N spaces."
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
173 (if (<= n 8) (aref spaces-strings n)
99298
225286546090 Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 96440
diff changeset
174 (make-string n ?\s)))
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46512
diff changeset
175
258
1e0bc00dca7a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 242
diff changeset
176 ;;;###autoload
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
177 (defun delete-rectangle (start end &optional fill)
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
178 "Delete (don't save) text in the region-rectangle.
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
179 The same range of columns is deleted in each line starting with the
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
180 line where the region begins and ending with the line where the region
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
181 ends.
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
182
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
183 When called from a program the rectangle's corners are START and END.
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
184 With a prefix (or a FILL) argument, also fill lines where nothing has
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
185 to be deleted."
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
186 (interactive "*r\nP")
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
187 (apply-on-rectangle 'delete-rectangle-line start end fill))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
188
258
1e0bc00dca7a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 242
diff changeset
189 ;;;###autoload
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
190 (defun delete-extract-rectangle (start end &optional fill)
25380
b5ef1f54a2ca (delete-extract-rectangle): Doc fix from verna.
Dave Love <fx@gnu.org>
parents: 25379
diff changeset
191 "Delete the contents of the rectangle with corners at START and END.
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
192 Return it as a list of strings, one for each line of the rectangle.
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
193
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
194 When called from a program the rectangle's corners are START and END.
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
195 With an optional FILL argument, also fill lines where nothing has to be
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
196 deleted."
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
197 (let ((lines (list nil)))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
198 (apply-on-rectangle 'delete-extract-rectangle-line start end lines fill)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
199 (nreverse (cdr lines))))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
200
258
1e0bc00dca7a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 242
diff changeset
201 ;;;###autoload
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
202 (defun extract-rectangle (start end)
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
203 "Return the contents of the rectangle with corners at START and END.
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
204 Return it as a list of strings, one for each line of the rectangle."
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
205 (let ((lines (list nil)))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
206 (apply-on-rectangle 'extract-rectangle-line start end lines)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
207 (nreverse (cdr lines))))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
208
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
209 (defvar killed-rectangle nil
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
210 "Rectangle for `yank-rectangle' to insert.")
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
211
258
1e0bc00dca7a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 242
diff changeset
212 ;;;###autoload
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
213 (defun kill-rectangle (start end &optional fill)
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
214 "Delete the region-rectangle and save it as the last killed one.
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
215
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
216 When called from a program the rectangle's corners are START and END.
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
217 You might prefer to use `delete-extract-rectangle' from a program.
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
218
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
219 With a prefix (or a FILL) argument, also fill lines where nothing has to be
69862
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
220 deleted.
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
221
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
222 If the buffer is read-only, Emacs will beep and refrain from deleting
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
223 the rectangle, but put it in the kill ring anyway. This means that
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
224 you can use this command to copy text from a read-only buffer.
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
225 \(If the variable `kill-read-only-ok' is non-nil, then this won't
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
226 even beep.)"
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
227 (interactive "r\nP")
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
228 (condition-case nil
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
229 (setq killed-rectangle (delete-extract-rectangle start end fill))
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
230 ((buffer-read-only text-read-only)
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
231 (setq killed-rectangle (extract-rectangle start end))
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
232 (if kill-read-only-ok
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
233 (progn (message "Read only text copied to kill ring") nil)
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
234 (barf-if-buffer-read-only)
dd0c0f578fc9 (kill-rectangle): Don't barf if `kill-read-only-ok' is set.
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
235 (signal 'text-read-only (list (current-buffer)))))))
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
236
258
1e0bc00dca7a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 242
diff changeset
237 ;;;###autoload
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
238 (defun yank-rectangle ()
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
239 "Yank the last killed rectangle with upper left corner at point."
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
240 (interactive "*")
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
241 (insert-rectangle killed-rectangle))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
242
258
1e0bc00dca7a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 242
diff changeset
243 ;;;###autoload
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
244 (defun insert-rectangle (rectangle)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
245 "Insert text of RECTANGLE with upper left corner at point.
242
5647f2040009 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 36
diff changeset
246 RECTANGLE's first line is inserted at point, its second
5647f2040009 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 36
diff changeset
247 line is inserted at a point vertically under point, etc.
1542
724b443e445d (insert-rectangle): Put mark at upper left corner.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
248 RECTANGLE should be a list of strings.
724b443e445d (insert-rectangle): Put mark at upper left corner.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
249 After this command, the mark is at the upper left corner
724b443e445d (insert-rectangle): Put mark at upper left corner.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
250 and point is at the lower right corner."
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
251 (let ((lines rectangle)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
252 (insertcolumn (current-column))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
253 (first t))
1542
724b443e445d (insert-rectangle): Put mark at upper left corner.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
254 (push-mark)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
255 (while lines
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
256 (or first
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
257 (progn
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
258 (forward-line 1)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
259 (or (bolp) (insert ?\n))
41173
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
260 (move-to-column insertcolumn t)))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
261 (setq first nil)
44676
37fdab0b94fa (insert-rectangle): Use insert-for-yank.
Richard M. Stallman <rms@gnu.org>
parents: 44207
diff changeset
262 (insert-for-yank (car lines))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
263 (setq lines (cdr lines)))))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
264
258
1e0bc00dca7a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 242
diff changeset
265 ;;;###autoload
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
266 (defun open-rectangle (start end &optional fill)
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
267 "Blank out the region-rectangle, shifting text right.
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
268
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
269 The text previously in the region is not overwritten by the blanks,
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
270 but instead winds up to the right of the rectangle.
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
271
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
272 When called from a program the rectangle's corners are START and END.
99298
225286546090 Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 96440
diff changeset
273 With a prefix (or a FILL) argument, fill with blanks even if there is
225286546090 Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 96440
diff changeset
274 no text on the right side of the rectangle."
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
275 (interactive "*r\nP")
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
276 (apply-on-rectangle 'open-rectangle-line start end fill)
1619
6147d2164331 * rect.el (operate-on-rectangle): Use move-to-column's FORCE
Jim Blandy <jimb@redhat.com>
parents: 1542
diff changeset
277 (goto-char start))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
278
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
279 (defun open-rectangle-line (startcol endcol fill)
59783
b2ab001718c6 (delete-rectangle-line, delete-extract-rectangle-line)
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
280 (when (= (move-to-column startcol (if fill t 'coerce)) startcol)
30283
70a7936c29c5 (open-rectangle-line): Remove unused let.
Dave Love <fx@gnu.org>
parents: 28078
diff changeset
281 (unless (and (not fill)
70a7936c29c5 (open-rectangle-line): Remove unused let.
Dave Love <fx@gnu.org>
parents: 28078
diff changeset
282 (= (point) (point-at-eol)))
70a7936c29c5 (open-rectangle-line): Remove unused let.
Dave Love <fx@gnu.org>
parents: 28078
diff changeset
283 (indent-to endcol))))
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
284
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
285 (defun delete-whitespace-rectangle-line (startcol endcol fill)
59783
b2ab001718c6 (delete-rectangle-line, delete-extract-rectangle-line)
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
286 (when (= (move-to-column startcol (if fill t 'coerce)) startcol)
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
287 (unless (= (point) (point-at-eol))
37444
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
288 (delete-region (point) (progn (skip-syntax-forward " ") (point))))))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
289
45168
4f3c96288c84 (close-rectangle): Don't hide it behind the autoload-cookie.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 44676
diff changeset
290 ;;;###autoload
4f3c96288c84 (close-rectangle): Don't hide it behind the autoload-cookie.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 44676
diff changeset
291 (defalias 'close-rectangle 'delete-whitespace-rectangle) ;; Old name
4f3c96288c84 (close-rectangle): Don't hide it behind the autoload-cookie.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 44676
diff changeset
292
258
1e0bc00dca7a *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 242
diff changeset
293 ;;;###autoload
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
294 (defun delete-whitespace-rectangle (start end &optional fill)
22205
8576d32229fc (close-rectangle): New command.
Richard M. Stallman <rms@gnu.org>
parents: 19732
diff changeset
295 "Delete all whitespace following a specified column in each line.
8576d32229fc (close-rectangle): New command.
Richard M. Stallman <rms@gnu.org>
parents: 19732
diff changeset
296 The left edge of the rectangle specifies the position in each line
8576d32229fc (close-rectangle): New command.
Richard M. Stallman <rms@gnu.org>
parents: 19732
diff changeset
297 at which whitespace deletion should begin. On each line in the
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
298 rectangle, all continuous whitespace starting at that column is deleted.
22205
8576d32229fc (close-rectangle): New command.
Richard M. Stallman <rms@gnu.org>
parents: 19732
diff changeset
299
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
300 When called from a program the rectangle's corners are START and END.
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
301 With a prefix (or a FILL) argument, also fill too short lines."
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
302 (interactive "*r\nP")
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
303 (apply-on-rectangle 'delete-whitespace-rectangle-line start end fill))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
304
41173
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
305 (defvar string-rectangle-history nil)
33772
4787f33fe54f (string-rectangle): Revert last change.
Dave Love <fx@gnu.org>
parents: 33750
diff changeset
306 (defun string-rectangle-line (startcol endcol string delete)
41173
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
307 (move-to-column startcol t)
33772
4787f33fe54f (string-rectangle): Revert last change.
Dave Love <fx@gnu.org>
parents: 33750
diff changeset
308 (if delete
4787f33fe54f (string-rectangle): Revert last change.
Dave Love <fx@gnu.org>
parents: 33750
diff changeset
309 (delete-rectangle-line startcol endcol nil))
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
310 (insert string))
2380
e67f6d2679e3 (fill-rectangle) Added. Inspired by Lynn Slater's insert-box package in LCD,
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2308
diff changeset
311
e67f6d2679e3 (fill-rectangle) Added. Inspired by Lynn Slater's insert-box package in LCD,
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2308
diff changeset
312 ;;;###autoload
37444
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
313 (defun string-rectangle (start end string)
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
314 "Replace rectangle contents with STRING on each line.
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
315 The length of STRING need not be the same as the rectangle width.
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
316
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
317 Called from a program, takes three args; START, END and STRING."
41173
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
318 (interactive
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
319 (progn (barf-if-buffer-read-only)
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
320 (list
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
321 (region-beginning)
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
322 (region-end)
65680
ed770a0a7846 2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents: 64762
diff changeset
323 (read-string (format "String rectangle (default %s): "
41173
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
324 (or (car string-rectangle-history) ""))
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
325 nil 'string-rectangle-history
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
326 (car string-rectangle-history)))))
33772
4787f33fe54f (string-rectangle): Revert last change.
Dave Love <fx@gnu.org>
parents: 33750
diff changeset
327 (apply-on-rectangle 'string-rectangle-line start end string t))
28078
99865d22cc31 2000-09-01 Didier Verna <didier@xemacs.org>
Dave Love <fx@gnu.org>
parents: 25380
diff changeset
328
44207
6c55bf040a71 (replace-rectangle): Add autoload.
Richard M. Stallman <rms@gnu.org>
parents: 43555
diff changeset
329 ;;;###autoload
37444
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
330 (defalias 'replace-rectangle 'string-rectangle)
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
331
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
332 ;;;###autoload
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
333 (defun string-insert-rectangle (start end string)
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
334 "Insert STRING on each line of region-rectangle, shifting text right.
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
335
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
336 When called from a program, the rectangle's corners are START and END.
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
337 The left edge of the rectangle specifies the column for insertion.
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
338 This command does not delete or overwrite any existing text."
41173
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
339 (interactive
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
340 (progn (barf-if-buffer-read-only)
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
341 (list
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
342 (region-beginning)
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
343 (region-end)
65680
ed770a0a7846 2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents: 64762
diff changeset
344 (read-string (format "String insert rectangle (default %s): "
41173
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
345 (or (car string-rectangle-history) ""))
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
346 nil 'string-rectangle-history
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
347 (car string-rectangle-history)))))
37444
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
348 (apply-on-rectangle 'string-rectangle-line start end string nil))
d5ed9aa37aa2 (string-rectangle): Revert to 20.x behaviour.
Gerd Moellmann <gerd@gnu.org>
parents: 33807
diff changeset
349
28078
99865d22cc31 2000-09-01 Didier Verna <didier@xemacs.org>
Dave Love <fx@gnu.org>
parents: 25380
diff changeset
350 ;;;###autoload
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
351 (defun clear-rectangle (start end &optional fill)
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
352 "Blank out the region-rectangle.
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
353 The text previously in the region is overwritten with blanks.
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
354
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
355 When called from a program the rectangle's corners are START and END.
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
356 With a prefix (or a FILL) argument, also fill with blanks the parts of the
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
357 rectangle which were empty."
25379
167c69238538 Add/fix various doc strings. Add `*' to all the interactive specs.
Dave Love <fx@gnu.org>
parents: 25291
diff changeset
358 (interactive "*r\nP")
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
359 (apply-on-rectangle 'clear-rectangle-line start end fill))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
360
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
361 (defun clear-rectangle-line (startcol endcol fill)
43555
c33c91ae60fc (clear-rectangle-line): Reindent to the same column
Richard M. Stallman <rms@gnu.org>
parents: 41173
diff changeset
362 (let ((pt (point-at-eol)))
59783
b2ab001718c6 (delete-rectangle-line, delete-extract-rectangle-line)
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
363 (when (= (move-to-column startcol (if fill t 'coerce)) startcol)
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
364 (if (and (not fill)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
365 (<= (save-excursion (goto-char pt) (current-column)) endcol))
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
366 (delete-region (point) pt)
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
367 ;; else
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
368 (setq pt (point))
41173
e1285c5daeaf (move-to-column-force): Mark obsolete.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39537
diff changeset
369 (move-to-column endcol t)
43555
c33c91ae60fc (clear-rectangle-line): Reindent to the same column
Richard M. Stallman <rms@gnu.org>
parents: 41173
diff changeset
370 (setq endcol (current-column))
25168
0fbd51325497 All functions rewritten, except when noted above
Richard M. Stallman <rms@gnu.org>
parents: 23812
diff changeset
371 (delete-region pt (point))
43555
c33c91ae60fc (clear-rectangle-line): Reindent to the same column
Richard M. Stallman <rms@gnu.org>
parents: 41173
diff changeset
372 (indent-to endcol)))))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
373
111970
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
374 ;; Line numbers for `rectangle-number-line-callback'.
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
375 (defvar rectangle-number-line-counter)
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
376
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
377 (defun rectangle-number-line-callback (start end format-string)
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
378 (move-to-column start t)
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
379 (insert (format format-string rectangle-number-line-counter))
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
380 (setq rectangle-number-line-counter
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
381 (1+ rectangle-number-line-counter)))
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
382
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
383 (defun rectange--default-line-number-format (start end start-at)
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
384 (concat "%"
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
385 (int-to-string (length (int-to-string (+ (count-lines start end)
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
386 start-at))))
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
387 "d "))
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
388
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
389 ;;;###autoload
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
390 (defun rectangle-number-lines (start end start-at &optional format)
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
391 "Insert numbers in front of the region-rectangle.
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
392
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
393 START-AT, if non-nil, should be a number from which to begin
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
394 counting. FORMAT, if non-nil, should be a format string to pass
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
395 to `format' along with the line count. When called interactively
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
396 with a prefix argument, prompt for START-AT and FORMAT."
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
397 (interactive
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
398 (if current-prefix-arg
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
399 (let* ((start (region-beginning))
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
400 (end (region-end))
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
401 (start-at (read-number "Number to count from: " 1)))
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
402 (list start end start-at
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
403 (read-string "Format string: "
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
404 (rectange--default-line-number-format
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
405 start end start-at))))
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
406 (list (region-beginning) (region-end) 1 nil)))
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
407 (unless format
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
408 (setq format (rectange--default-line-number-format start end start-at)))
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
409 (let ((rectangle-number-line-counter start-at))
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
410 (apply-on-rectangle 'rectangle-number-line-callback
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
411 start end format)))
9570b2539308 New command rectangle-number-lines (Bug#4382).
Chong Yidong <cyd@stupidchicken.com>
parents: 111969
diff changeset
412
1619
6147d2164331 * rect.el (operate-on-rectangle): Use move-to-column's FORCE
Jim Blandy <jimb@redhat.com>
parents: 1542
diff changeset
413 (provide 'rect)
659
505130d1ddf8 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 258
diff changeset
414
505130d1ddf8 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 258
diff changeset
415 ;;; rect.el ends here