(defvar regexp-history nil
"History list for some commands that read regular expressions.")
-(fset 'delete-non-matching-lines 'keep-lines)
+(defalias 'delete-non-matching-lines 'keep-lines)
(defun keep-lines (regexp)
"Delete all lines except those containing matches for REGEXP.
A match split across lines preserves all the lines it lies in.
Applies to all lines after point."
(interactive (list (read-from-minibuffer
- "sKeep lines (containing match for regexp): "
+ "Keep lines (containing match for regexp): "
nil nil nil 'regexp-history)))
(save-excursion
(or (bolp) (forward-line 1))
(and (not (eobp)) (= (match-beginning 0) (match-end 0))
(forward-char 1))))))
-(fset 'delete-matching-lines 'flush-lines)
+(defalias 'delete-matching-lines 'flush-lines)
(defun flush-lines (regexp)
"Delete lines containing matches for REGEXP.
If a match is split across lines, all the lines it lies in are deleted.
Applies to lines after point."
(interactive (list (read-from-minibuffer
- "sFlush lines (containing match for regexp): "
+ "Flush lines (containing match for regexp): "
nil nil nil 'regexp-history)))
(save-excursion
(while (and (not (eobp))
(point))
(progn (forward-line 1) (point))))))
-(fset 'count-matches 'how-many)
+(defalias 'count-matches 'how-many)
(defun how-many (regexp)
"Print number of matches for REGEXP following point."
(interactive (list (read-from-minibuffer
- "sHow many matches for (regexp): "
+ "How many matches for (regexp): "
nil nil nil 'regexp-history)))
(let ((count 0) opoint)
(save-excursion
match. A negative number means to include that many lines before the match.
A positive number means to include that many lines both before and after.")
-(fset 'list-matching-lines 'occur)
+(defalias 'list-matching-lines 'occur)
(defun occur (regexp &optional nlines)
"Show all lines in the current buffer containing a match for REGEXP.
(define-key query-replace-map "n" 'skip)
(define-key query-replace-map "," 'act-and-show)
(define-key query-replace-map "\e" 'exit)
+(define-key query-replace-map [escape] 'exit)
(define-key query-replace-map "q" 'exit)
+(define-key query-replace-map "\r" 'exit)
+(define-key query-replace-map [return] 'exit)
(define-key query-replace-map "." 'act-and-exit)
(define-key query-replace-map "\C-r" 'edit)
(define-key query-replace-map "\C-w" 'delete-and-edit)