comparison lisp/replace.el @ 2571:b65cf676a09b

All fsets changed to defaliases.
author Eric S. Raymond <esr@snark.thyrsus.com>
date Fri, 23 Apr 1993 06:51:44 +0000
parents a9c05a12b615
children b8c5199f31af
comparison
equal deleted inserted replaced
2570:a880046a1a67 2571:b65cf676a09b
144 (or unread-command-events (message "Done"))) 144 (or unread-command-events (message "Done")))
145 145
146 (defvar regexp-history nil 146 (defvar regexp-history nil
147 "History list for some commands that read regular expressions.") 147 "History list for some commands that read regular expressions.")
148 148
149 (fset 'delete-non-matching-lines 'keep-lines) 149 (defalias 'delete-non-matching-lines 'keep-lines)
150 (defun keep-lines (regexp) 150 (defun keep-lines (regexp)
151 "Delete all lines except those containing matches for REGEXP. 151 "Delete all lines except those containing matches for REGEXP.
152 A match split across lines preserves all the lines it lies in. 152 A match split across lines preserves all the lines it lies in.
153 Applies to all lines after point." 153 Applies to all lines after point."
154 (interactive (list (read-from-minibuffer 154 (interactive (list (read-from-minibuffer
171 (point))) 171 (point)))
172 ;; If the match was empty, avoid matching again at same place. 172 ;; If the match was empty, avoid matching again at same place.
173 (and (not (eobp)) (= (match-beginning 0) (match-end 0)) 173 (and (not (eobp)) (= (match-beginning 0) (match-end 0))
174 (forward-char 1)))))) 174 (forward-char 1))))))
175 175
176 (fset 'delete-matching-lines 'flush-lines) 176 (defalias 'delete-matching-lines 'flush-lines)
177 (defun flush-lines (regexp) 177 (defun flush-lines (regexp)
178 "Delete lines containing matches for REGEXP. 178 "Delete lines containing matches for REGEXP.
179 If a match is split across lines, all the lines it lies in are deleted. 179 If a match is split across lines, all the lines it lies in are deleted.
180 Applies to lines after point." 180 Applies to lines after point."
181 (interactive (list (read-from-minibuffer 181 (interactive (list (read-from-minibuffer
187 (delete-region (save-excursion (goto-char (match-beginning 0)) 187 (delete-region (save-excursion (goto-char (match-beginning 0))
188 (beginning-of-line) 188 (beginning-of-line)
189 (point)) 189 (point))
190 (progn (forward-line 1) (point)))))) 190 (progn (forward-line 1) (point))))))
191 191
192 (fset 'count-matches 'how-many) 192 (defalias 'count-matches 'how-many)
193 (defun how-many (regexp) 193 (defun how-many (regexp)
194 "Print number of matches for REGEXP following point." 194 "Print number of matches for REGEXP following point."
195 (interactive (list (read-from-minibuffer 195 (interactive (list (read-from-minibuffer
196 "sHow many matches for (regexp): " 196 "sHow many matches for (regexp): "
197 nil nil nil 'regexp-history))) 197 nil nil nil 'regexp-history)))
256 (defvar list-matching-lines-default-context-lines 0 256 (defvar list-matching-lines-default-context-lines 0
257 "*Default number of context lines to include around a `list-matching-lines' 257 "*Default number of context lines to include around a `list-matching-lines'
258 match. A negative number means to include that many lines before the match. 258 match. A negative number means to include that many lines before the match.
259 A positive number means to include that many lines both before and after.") 259 A positive number means to include that many lines both before and after.")
260 260
261 (fset 'list-matching-lines 'occur) 261 (defalias 'list-matching-lines 'occur)
262 262
263 (defun occur (regexp &optional nlines) 263 (defun occur (regexp &optional nlines)
264 "Show all lines in the current buffer containing a match for REGEXP. 264 "Show all lines in the current buffer containing a match for REGEXP.
265 265
266 If a match spreads across multiple lines, all those lines are shown. 266 If a match spreads across multiple lines, all those lines are shown.