
(fset (quote delete-non-matching-lines) (quote 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 "sKeep lines (containing match for regexp): ") (byte-code "n
 !`m?G 	#?\" d\"9 !b `)W8 \")!`) ))" [start regexp nil end forward-line 1 re-search-forward move delete-region match-beginning 0 beginning-of-line] 10))

(fset (quote delete-matching-lines) (quote 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 "sFlush lines (containing match for regexp): ") (byte-code "m? #& Ċ!b `)!`\" )" [regexp nil t re-search-forward delete-region match-beginning 0 beginning-of-line forward-line 1] 8))

(fset (quote count-matches) (quote how-many))

(defun how-many (regexp) "\
Print number of matches for REGEXP following point." (interactive "sHow many matches for (regexp): ") (byte-code "Èm? `
#, 	`U$ !( T \")*" [count opoint regexp nil t 0 re-search-forward forward-char 1 message "%d occurrences"] 5))

(defvar occur-mode-map nil)

(if occur-mode-map nil (setq occur-mode-map (make-sparse-keymap)) (define-key occur-mode-map "" (quote occur-mode-goto-occurrence)))

(defvar occur-buffer nil)

(defvar occur-nlines nil)

(defvar occur-pos-list nil)

(defun occur-mode nil "\
Major mode for output from \\[occur].
Move point to one of the occurrences in this buffer,
then use \\[occur-mode-goto-occurrence] to go to the same occurrence
in the buffer that the occurrences were found in.
\\{occur-mode-map}" (byte-code " !ŉƉ!!!" [occur-mode-map major-mode mode-name kill-all-local-variables use-local-map occur-mode "Occur" make-local-variable occur-buffer occur-nlines occur-pos-list] 6))

(defun occur-mode-goto-occurrence nil "\
Go to the line this occurrence was found in, in the buffer it was found in." (interactive) (byte-code "? !? ! e`\"SW. Z> V= \"\\> \")
8!!b*" [occur-buffer nil occur-pos-list occur-number occur-nlines t pos buffer-name error "Buffer in which occurences were found is deleted." beginning-of-line / count-lines 0 2 * 1 pop-to-buffer marker-position] 10))

(defvar list-matching-lines-default-context-lines 0 "\
*Default number of context lines to include around a list-matching-lines
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 (quote list-matching-lines) (quote occur))

(defun occur (regexp &optional nlines) "\
Show all lines following point containing a match for REGEXP.
Display each line with NLINES lines before and after,
 or -NLINES before if NLINES is negative.
NLINES defaults to list-matching-lines-default-context-lines.
Interactively it is the prefix arg.

The lines are shown in a buffer named *Occur*.
It serves as a menu to find any of the occurrences in this buffer.
\\[describe-mode] in that buffer will explain how." (interactive "sList lines matching regexp: 
P") (byte-code "̈ ! 	p e`\"T`)Րqc!!$ 	
̉)=_ dbdU?o #X!`\"\\`)W  [!`)V T! !`)\"G\" `\"qB
 ! c̉#Z!W[	V(\"!S\"!WN\"!T3)!-a q!toG\")," [nlines list-matching-lines-default-context-lines first t buffer linenum prevpos standard-output regexp occur-buffer occur-nlines occur-pos-list nil start end tag empty tem prefix-numeric-value beginning-of-line count-lines "*Occur*" "Lines matching " prin1 insert " in buffer " buffer-name 46 10 occur-mode re-search-forward 1 forward-line 0 format "%3d" make-string 32 make-marker set-marker zerop "--------
" insert-buffer-substring backward-char 58 nreverse message "%d matching lines."] 32))

(defconst query-replace-help "Type Space or `y' to replace one match, Delete or `n' to skip to next,
ESC or `q' to exit, Period to replace one match and exit,
Comma to replace but not move point immediately,
C-r to enter recursive edit (\\[exit-recursive-edit] to get out again),
C-w to delete match and recursive edit,
C-l to clear the screen, redisplay, and offer same replacement again,
! to replace all remaining matches with no more questions,
^ to move point back to previous match." "Help message while in query-replace")

(defun perform-replace (from-string to-string query-flag regexp-flag delimited-flag) (byte-code "	 
 !\"?? ؂ 
@ 8 ; !Q  ] m?] `!$
`=m ! ? #? U #rU  !*U U ˉɉU  bɉU U#ɉU3&#ˉɉUN?K#ɉUk`#ˉUvUɉU!U  )!U!!\"  )!ɉˉɉ *`
G  ." [nocasify case-fold-search case-replace from-string literal regexp-flag search-function search-string keep-going t lastrepl nil delimited-flag query-flag to-string done replaced data help-form char help-char unread-command-char string-equal downcase re-search-forward search-forward "\\b" regexp-quote push-mark set-mark funcall forward-char 1 undo-boundary replace-match match-data (concat "Query replacing " (if regexp-flag "regexp " "") from-string " with " to-string ".

" (substitute-command-keys query-replace-help)) message "Query replacing %s with %s: " 63 store-match-data 27 113 94 mark 32 121 46 44 33 127 110 12 recenter 18 recursive-edit 23 delete-region match-beginning 0 match-end pop-mark] 32))
