Mercurial > emacs
comparison lisp/macros.el @ 391:4b1d23627759
*** empty log message ***
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Wed, 14 Aug 1991 22:50:16 +0000 |
parents | 7121f18e0114 |
children | 1507978a453c |
comparison
equal
deleted
inserted
replaced
390:4dfee0c58c2a | 391:4b1d23627759 |
---|---|
104 (let (executing-macro defining-kbd-macro) | 104 (let (executing-macro defining-kbd-macro) |
105 (recursive-edit)))))))))) | 105 (recursive-edit)))))))))) |
106 | 106 |
107 ;;;###autoload | 107 ;;;###autoload |
108 (defun apply-macro-to-region-lines (top bottom &optional macro) | 108 (defun apply-macro-to-region-lines (top bottom &optional macro) |
109 "For each complete line in the current region, move to the beginning of | 109 "For each complete line between point and mark, move to the beginning |
110 the line, and run the last keyboard macro. | 110 of the line, and run the last keyboard macro. |
111 | 111 |
112 When called from lisp, this function takes two arguments TOP and | 112 When called from lisp, this function takes two arguments TOP and |
113 BOTTOM, describing the current region. TOP must be before BOTTOM. | 113 BOTTOM, describing the current region. TOP must be before BOTTOM. |
114 The optional third argument MACRO specifies a keyboard macro to | 114 The optional third argument MACRO specifies a keyboard macro to |
115 execute. | 115 execute. |
144 | 144 |
145 and then select the region of un-tablified names and use | 145 and then select the region of un-tablified names and use |
146 `\\[apply-macro-to-region-lines]' to build the table from the names. | 146 `\\[apply-macro-to-region-lines]' to build the table from the names. |
147 " | 147 " |
148 (interactive "r") | 148 (interactive "r") |
149 (if (null last-kbd-macro) | 149 (or macro |
150 (error "No keyboard macro has been defined.")) | 150 (progn |
151 (if (null last-kbd-macro) | |
152 (error "No keyboard macro has been defined.")) | |
153 (setq macro last-kbd-macro))) | |
151 (save-excursion | 154 (save-excursion |
152 (let ((end-marker (progn | 155 (let ((end-marker (progn |
153 (goto-char bottom) | 156 (goto-char bottom) |
154 (beginning-of-line) | 157 (beginning-of-line) |
155 (point-marker)))) | 158 (point-marker)))) |
156 (goto-char top) | 159 (goto-char top) |
157 (if (not (bolp)) | 160 (if (not (bolp)) |
158 (forward-line 1)) | 161 (forward-line 1)) |
159 (while (< (point) end-marker) | 162 (while (< (point) end-marker) |
160 (save-excursion | 163 (save-excursion |
161 (execute-kbd-macro (or macro last-kbd-macro))) | 164 (execute-kbd-macro macro)) |
162 (forward-line 1))))) | 165 (forward-line 1))))) |
163 | 166 |
164 ;;;###autoload | 167 ;;;###autoload |
165 (define-key ctl-x-map "q" 'kbd-macro-query) | 168 (define-key ctl-x-map "q" 'kbd-macro-query) |