;ELC ;;; compiled by kwzh@hal.gnu.ai.mit.edu on Tue Aug 30 22:33:36 1994 ;;; from file /amd/churchy/home/gd/gnu/emacs/19.0/lisp/replace.el ;;; emacs version 19.25.95.1. ;;; bytecomp version FSF 2.10 ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "`/amd/churchy/home/gd/gnu/emacs/19.0/lisp/replace.el' was compiled for Emacs 19")) (defconst case-replace t "\ *Non-nil means query-replace should preserve case in replacements.") (byte-code "!\"" [boundp query-replace-history nil defalias query-replace-read-args #[(string) "\"%\n#%\n  E*" [nil to from read-from-minibuffer format "%s: " string query-replace-history "%s %s with: " current-prefix-arg] 6]] 3) (defalias 'query-replace #[(from-string to-string &optional arg) " \n %!" [perform-replace from-string to-string t nil arg unread-command-events message "Done"] 6 "\ Replace some occurrences of FROM-STRING with TO-STRING. As each match is found, the user must type a character saying what to do with it. For directions, type \\[help-command] at that time. Preserves case in each replacement if `case-replace' and `case-fold-search' are non-nil and FROM-STRING has no uppercase letters. Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. To customize possible responses, change the \"bindings\" in `query-replace-map'." (query-replace-read-args "Query replace")]) (define-key esc-map "%" (quote query-replace)) (defalias 'query-replace-regexp #[(regexp to-string &optional arg) " \nÉ\f% !" [perform-replace regexp to-string t arg unread-command-events message "Done"] 6 "\ Replace some things after point matching REGEXP with TO-STRING. As each match is found, the user must type a character saying what to do with it. For directions, type \\[help-command] at that time. Preserves case in each replacement if `case-replace' and `case-fold-search' are non-nil and REGEXP has no uppercase letters. Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. In TO-STRING, `\\&' stands for whatever matched the whole of REGEXP, and `\\=\\N' (where N is a digit) stands for whatever what matched the Nth `\\(...\\)' in REGEXP." (query-replace-read-args "Query replace regexp")]) (defalias 'map-query-replace-regexp #[(regexp to-strings &optional arg) "\n<\f\n?\nGU?\n\"3 \n\n\"OC\"\n\n\"TO \nC\"lj  ʉ &)\fT!" [nil replacements to-strings 0 string-match " " append "" perform-replace regexp t arg unread-command-events message "Done"] 8 "\ Replace some matches for REGEXP with various strings, in rotation. The second argument TO-STRINGS contains the replacement strings, separated by spaces. This command works like `query-replace-regexp' except that each successive replacement uses the next successive replacement string, wrapping around from the last such string to the first. Non-interactively, TO-STRINGS may be a list of replacement strings. A prefix argument N says to use each replacement string N times before rotating to the next." (byte-code "%\n\"%\n E*" [nil to from read-from-minibuffer "Map query replace (regexp): " query-replace-history format "Query replace %s with (space-separated strings): " current-prefix-arg] 6)]) (defalias 'replace-string #[(from-string to-string &optional delimited) " \nÉ\f% !" [perform-replace from-string to-string nil delimited unread-command-events message "Done"] 6 "\ Replace occurrences of FROM-STRING with TO-STRING. Preserve case in each match if `case-replace' and `case-fold-search' are non-nil and FROM-STRING has no uppercase letters. Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. This function is usually the wrong thing to use in a Lisp program. What you probably want is a loop like this: (while (search-forward FROM-STRING nil t) (replace-match TO-STRING nil t)) which will run faster and will not set the mark or print anything." (query-replace-read-args "Replace string")]) (defalias 'replace-regexp #[(regexp to-string &optional delimited) " \n %!" [perform-replace regexp to-string nil t delimited unread-command-events message "Done"] 6 "\ Replace things after point matching REGEXP with TO-STRING. Preserve case in each match if `case-replace' and `case-fold-search' are non-nil and REGEXP has no uppercase letters. Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. In TO-STRING, `\\&' stands for whatever matched the whole of REGEXP, and `\\=\\N' (where N is a digit) stands for whatever what matched the Nth `\\(...\\)' in REGEXP. This function is usually the wrong thing to use in a Lisp program. What you probably want is a loop like this: (while (re-search-forward REGEXP nil t) (replace-match TO-STRING nil nil)) which will run faster and will not set the mark or print anything." (query-replace-read-args "Replace regexp")]) (defvar regexp-history nil "\ History list for some commands that read regular expressions.") (defalias (quote delete-non-matching-lines) (quote keep-lines)) (defalias 'keep-lines #[(regexp) "ny`m?P # d|7Ɣby`) W6 |)y`)m\nƔƕU\nu\n*" [1 start re-search-forward regexp nil move 0 end] 4 "\ 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." (list (read-from-minibuffer "Keep lines (containing match for regexp): " nil nil nil (quote regexp-history)))]) (defalias (quote delete-matching-lines) (quote flush-lines)) (defalias 'flush-lines #[(regexp) "m?! #!Ĕby`)y`|)" [re-search-forward regexp nil t 0 1] 4 "\ 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." (list (read-from-minibuffer "Flush lines (containing match for regexp): " nil nil nil (quote regexp-history)))]) (defalias (quote count-matches) (quote how-many)) (defalias 'how-many #[(regexp) "m%` #%\n`Uu T \"+" [0 nil opoint count re-search-forward regexp t 1 message "%d occurrences"] 4 "\ Print number of matches for REGEXP following point." (list (read-from-minibuffer "How many matches for (regexp): " nil nil nil (quote regexp-history)))]) (byte-code "!   # #!$ !-\n!6 ‡" [boundp occur-mode-map nil make-sparse-keymap define-key [mouse-2] occur-mode-mouse-goto "" occur-mode-goto-occurrence occur-buffer occur-nlines occur-pos-list] 4) (defalias 'occur-mode #[nil " \n!!!!!" [kill-all-local-variables use-local-map occur-mode-map occur-mode major-mode "Occur" mode-name make-local-variable occur-buffer occur-nlines occur-pos-list run-hooks occur-mode-hook] 2 "\ 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. Or click \\\\[occur-mode-mouse-goto] on an occurrence line. \\{occur-mode-map}"]) (defalias 'occur-mode-mouse-goto #[(event) "\f\f8:ł\f8)@)!q\f\f8:-ł.\f8)A@:BA@@FA@)b  *\n! !b*" [nil pos buffer window-buffer event 2 1 position occur-mode-find-occurrence occur-buffer pop-to-buffer marker-position] 4 "\ In Occur mode, go to the occurrence whose line you click on." "e"]) (defalias (quote occur-mode-find-occurrence) #[nil "\n!!ey`)\"yS W2 ZC VB \\\\C˥)\f 8 WW! `! +" [occur-buffer buffer-name nil occur-pos-list error "Buffer in which occurrences were found is deleted" count-lines 0 line-count occur-nlines 2 1 occur-number pos "No occurrence on this line"] 4]) (defalias 'occur-mode-goto-occurrence #[nil "  ! !b)" [occur-mode-find-occurrence pos pop-to-buffer occur-buffer marker-position] 2 "\ Go to the occurrence the current line describes." nil]) (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.") (defalias (quote list-matching-lines) (quote occur)) (defalias 'occur #[(regexp &optional nlines) "\n! \npe  \nː\fqc! !ӱ  ) \f=Ndb dU#۔by ގ`\"\\*`ەb۔bW[y`) ەbVTyy`)!\"$$G\"'( (`ד\fq(B\n!c\n  !#! Z!(V'y(S(.`ە۔Z\\ד`W]$8.\"$$y`)`)$$y.T.%)(Ww'y(T(`)y-R\fqtG\")-" [nlines prefix-numeric-value list-matching-lines-default-context-lines t 1 make-marker final-context-start prevpos linenum buffer first "*Occur*" standard-output "Lines matching " prin1 regexp " in buffer " buffer-name 46 10 occur-mode occur-buffer occur-nlines nil occur-pos-list beginning-of-buffer re-search-forward 0 match-data match-data ((store-match-data match-data)) count-lines start end format "%3d" tag make-string 32 empty tem zerop "--------\n" insert-buffer-substring backward-char 58 this-linenum put-text-property mouse-face highlight message "%d matching lines."] 7 "\ Show all lines in the current buffer containing a match for REGEXP. If a match spreads across multiple lines, all those lines are shown. Each line is displayed 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." (list (let* ((default (car regexp-history)) (input (read-from-minibuffer (if default (format "List lines matching regexp (default `%s'): " default) "List lines matching regexp: ") nil nil nil (quote regexp-history)))) (if (> (length input) 0) input (setcar regexp-history default))) current-prefix-arg)]) (defconst query-replace-help "Type Space or `y' to replace one match, Delete or `n' to skip to next,\nRET or `q' to exit, Period to replace one match and exit,\nComma to replace but not move point immediately,\nC-r to enter recursive edit (\\[exit-recursive-edit] to get out again),\nC-w to delete match and recursive edit,\nC-l to clear the screen, redisplay, and offer same replacement again,\n! to replace all remaining matches with no more questions,\n^ to move point back to previous match." "\ Help message while in query-replace") (defvar query-replace-map (make-sparse-keymap) "\ Keymap that defines the responses to questions in `query-replace'. The \"bindings\" in this map are not commands; they are answers. The valid answers include `act', `skip', `act-and-show', `exit', `act-and-exit', `edit', `delete-and-edit', `recenter', `automatic', `backup', and `help'.") (byte-code " # # # # # # # # # # # # # # # # # # # #" [define-key query-replace-map " " act "" skip [delete] [backspace] "y" "n" "," act-and-show "q" exit " " [return] "." act-and-exit "" edit "" delete-and-edit "\f" recenter "!" automatic "^" backup "" help "?" "" quit ""] 4) (defalias 'perform-replace #[(from-string replacements query-flag regexp-flag delimited-flag &optional repeat-count map) " \n \f? ? Ƃ\fȉɉ 0!;Yaay r\fu\f!Q m#`= ɔ=mu#ʃ  !<U\\8TG !#T ȉ)*+,,!ɔɕ\"\f# **!**\")=l Z[\f9!!)=}ʉ, )=@<@b\\[help] for help) " message match-again lastrepl replace-count next-rotate-count stack keep-going replacement-index next-replacement real-match-data search-string search-function literal nocasify replacements repeat-count 1 delimited-flag "\\b" regexp-quote push-mark undo-boundary ((replace-dehighlight)) match-data looking-at store-match-data replace-match def key replaced done replace-highlight read-event vector lookup-key help "*Help*" princ "Query replacing " "regexp " "" " with " ".\n\n" query-replace-help exit backup elt "No previous match" ding no-terminate sit-for act act-and-exit act-and-show automatic skip recenter edit recursive-edit delete-and-edit append listify-key-sequence unread-command-events mapcar #[(elt) "\f!‰" [elt marker-position nil] 4]] 16 "\ Subroutine of `query-replace'. Its complexity handles interactive queries. Don't use this in your own program unless you want to query and set the mark just as `query-replace' does. Instead, write a simple loop like this: (while (re-search-forward \"foo[ ]+bar\" nil t) (replace-match \"foobar\" nil nil)) which will run faster and probably do exactly what you want."]) (defvar query-replace-highlight nil "\ *Non-nil means to highlight words during query replacement.") (byte-code "!\"\"" [boundp replace-overlay nil defalias replace-dehighlight #[nil " !‰" [replace-overlay delete-overlay nil] 2] replace-highlight #[(start end) "#  \f\" !Ȃ# \fp$" [query-replace-highlight replace-overlay make-overlay start end overlay-put face internal-find-face query-replace region move-overlay] 5]] 3)