aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorRichard M. Stallman1992-10-18 01:06:40 +0000
committerRichard M. Stallman1992-10-18 01:06:40 +0000
commit99976f85b717743c3083046d7255ff4e04a9f0ef (patch)
tree9813f442d83ed3b4536d3c2712e4e66bdd7f3811 /lisp/replace.el
parentccdac5be86aeda3f78317dd0d824677d80f21496 (diff)
downloademacs-99976f85b717743c3083046d7255ff4e04a9f0ef.tar.gz
emacs-99976f85b717743c3083046d7255ff4e04a9f0ef.zip
(occur): Always search entire buffer.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el21
1 files changed, 7 insertions, 14 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 22b7cde167c..beee0df738a 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -243,16 +243,11 @@ in the buffer that the occurrences were found in.
243match. A negative number means to include that many lines before the match. 243match. A negative number means to include that many lines before the match.
244A positive number means to include that many lines both before and after.") 244A positive number means to include that many lines both before and after.")
245 245
246(defvar occur-whole-buffer nil
247 "If t, occur operates on whole buffer, otherwise occur starts from point.
248default is nil.")
249
250(fset 'list-matching-lines 'occur) 246(fset 'list-matching-lines 'occur)
251 247
252(defun occur (regexp &optional nlines) 248(defun occur (regexp &optional nlines)
253 "Show lines containing a match for REGEXP. If the global variable 249 "Show all lines in the current buffer containing a match for REGEXP.
254`occur-whole-buffer' is non-nil, the entire buffer is searched, otherwise 250Interactively, REGEXP defaults to the last REGEXP
255search begins at point. Interactively, REGEXP defaults to the last REGEXP
256used interactively with \\[occur]. 251used interactively with \\[occur].
257 252
258If a match spreads across multiple lines, all those lines are shown. 253If a match spreads across multiple lines, all those lines are shown.
@@ -276,11 +271,10 @@ It serves as a menu to find any of the occurrences in this buffer.
276 (linenum 1) 271 (linenum 1)
277 (prevpos (point-min)) 272 (prevpos (point-min))
278 (final-context-start (make-marker))) 273 (final-context-start (make-marker)))
279 (if (not occur-whole-buffer) 274;;; (save-excursion
280 (save-excursion 275;;; (beginning-of-line)
281 (beginning-of-line) 276;;; (setq linenum (1+ (count-lines (point-min) (point))))
282 (setq linenum (1+ (count-lines (point-min) (point)))) 277;;; (setq prevpos (point)))
283 (setq prevpos (point))))
284 (with-output-to-temp-buffer "*Occur*" 278 (with-output-to-temp-buffer "*Occur*"
285 (save-excursion 279 (save-excursion
286 (set-buffer standard-output) 280 (set-buffer standard-output)
@@ -294,8 +288,7 @@ It serves as a menu to find any of the occurrences in this buffer.
294 (if (eq buffer standard-output) 288 (if (eq buffer standard-output)
295 (goto-char (point-max))) 289 (goto-char (point-max)))
296 (save-excursion 290 (save-excursion
297 (if occur-whole-buffer 291 (beginning-of-buffer)
298 (beginning-of-buffer))
299 ;; Find next match, but give up if prev match was at end of buffer. 292 ;; Find next match, but give up if prev match was at end of buffer.
300 (while (and (not (= prevpos (point-max))) 293 (while (and (not (= prevpos (point-max)))
301 (re-search-forward regexp nil t)) 294 (re-search-forward regexp nil t))