summaryrefslogtreecommitdiff
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorroot <root>1990-07-26 02:44:32 +0000
committerroot <root>1990-07-26 02:44:32 +0000
commitf1c9e147116c7874d483853d0aa98bf0557ac6e8 (patch)
treea7b66c19d28ad4cdf380f1536407efaad97f3860 /lisp/replace.el
parent9b23a2ce6f5e318fdb724923e85718e67404e050 (diff)
downloademacs-f1c9e147116c7874d483853d0aa98bf0557ac6e8.tar.gz
emacs-f1c9e147116c7874d483853d0aa98bf0557ac6e8.tar.bz2
emacs-f1c9e147116c7874d483853d0aa98bf0557ac6e8.zip
*** empty log message ***
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index a7c4f9630dd..fabcd11a554 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -80,6 +80,7 @@ Applies to lines after point."
(defvar occur-buffer nil)
(defvar occur-nlines nil)
(defvar occur-pos-list nil)
+(defvar occur-last-string "")
(defun occur-mode ()
"Major mode for output from \\[occur].
@@ -131,19 +132,23 @@ default is nil.")
(fset 'list-matching-lines 'occur)
(defun occur (regexp &optional nlines)
- "Show lines containing a match for REGEXP. If the global variable
+ "Show lines containing a match for REGEXP. If the global variable
occur-whole-buffer is non-nil, the entire buffer is searched, otherwise
-search begins at point.
+search begins at point. Interactively, REGEXP defaults to the last REGEXP
+used interactively.
Each line is displayed with NLINES lines before and after,
- or -NLINES before if NLINES is negative.
+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: \nP")
+ (interactive (list (setq occur-last-string
+ (read-string "List lines matching regexp: "
+ occur-last-string))
+ current-prefix-arg))
(setq nlines (if nlines (prefix-numeric-value nlines)
list-matching-lines-default-context-lines))
(let ((first t)