diff options
| author | Juanma Barranquero | 2002-09-24 08:35:43 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2002-09-24 08:35:43 +0000 |
| commit | 123d55481b2a42dde751c2d3b74d05e001ef602b (patch) | |
| tree | 09fdf5421c136801d5e38a752229f6e6eb8cade6 /lisp | |
| parent | d5ec6a2da4b2138be6bf183b797eed40291dc89e (diff) | |
| download | emacs-123d55481b2a42dde751c2d3b74d05e001ef602b.tar.gz emacs-123d55481b2a42dde751c2d3b74d05e001ef602b.zip | |
(occur-find-match): New function.
(occur-next, occur-prev): Use it.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/replace.el | 34 |
2 files changed, 18 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9f58dcccddc..65954541201 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2002-09-24 Juanma Barranquero <lektu@terra.es> | ||
| 2 | |||
| 3 | * replace.el (occur-find-match): New function. | ||
| 4 | (occur-next, occur-prev): Use it. | ||
| 5 | |||
| 1 | 2002-09-23 Kenichi Handa <handa@etl.go.jp> | 6 | 2002-09-23 Kenichi Handa <handa@etl.go.jp> |
| 2 | 7 | ||
| 3 | * international/quail.el (quail-completion): Be sure to scroll | 8 | * international/quail.el (quail-completion): Be sure to scroll |
diff --git a/lisp/replace.el b/lisp/replace.el index f24a5fde9df..c2c39cbd219 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -544,36 +544,28 @@ Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it. | |||
| 544 | (select-window window) | 544 | (select-window window) |
| 545 | (goto-char pos)))) | 545 | (goto-char pos)))) |
| 546 | 546 | ||
| 547 | (defun occur-next (&optional n) | 547 | (defun occur-find-match (n search message) |
| 548 | "Move to the Nth (default 1) next match in an Occur mode buffer." | ||
| 549 | (interactive "p") | ||
| 550 | (if (not n) (setq n 1)) | 548 | (if (not n) (setq n 1)) |
| 551 | (let ((r)) | 549 | (let ((r)) |
| 552 | (while (> n 0) | 550 | (while (> n 0) |
| 553 | (if (get-text-property (point) 'occur-point) | 551 | (setq r (funcall search (point) 'occur-match)) |
| 554 | (forward-char 1)) | 552 | (and r |
| 555 | (setq r (next-single-property-change (point) 'occur-point)) | 553 | (get-text-property r 'occur-match) |
| 554 | (setq r (funcall search r 'occur-match))) | ||
| 556 | (if r | 555 | (if r |
| 557 | (goto-char r) | 556 | (goto-char r) |
| 558 | (error "No more matches")) | 557 | (error message)) |
| 559 | (setq n (1- n))))) | 558 | (setq n (1- n))))) |
| 560 | 559 | ||
| 560 | (defun occur-next (&optional n) | ||
| 561 | "Move to the Nth (default 1) next match in an Occur mode buffer." | ||
| 562 | (interactive "p") | ||
| 563 | (occur-find-match n #'next-single-property-change "No more matches")) | ||
| 564 | |||
| 561 | (defun occur-prev (&optional n) | 565 | (defun occur-prev (&optional n) |
| 562 | "Move to the Nth (default 1) previous match in an Occur mode buffer." | 566 | "Move to the Nth (default 1) previous match in an Occur mode buffer." |
| 563 | (interactive "p") | 567 | (interactive "p") |
| 564 | (if (not n) (setq n 1)) | 568 | (occur-find-match n #'previous-single-property-change "No earlier matches")) |
| 565 | (let ((r)) | ||
| 566 | (while (> n 0) | ||
| 567 | |||
| 568 | (setq r (get-text-property (point) 'occur-point)) | ||
| 569 | (if r (forward-char -1)) | ||
| 570 | |||
| 571 | (setq r (previous-single-property-change (point) 'occur-point)) | ||
| 572 | (if r | ||
| 573 | (goto-char (- r 1)) | ||
| 574 | (error "No earlier matches")) | ||
| 575 | |||
| 576 | (setq n (1- n))))) | ||
| 577 | 569 | ||
| 578 | (defcustom list-matching-lines-default-context-lines 0 | 570 | (defcustom list-matching-lines-default-context-lines 0 |
| 579 | "*Default number of context lines included around `list-matching-lines' matches. | 571 | "*Default number of context lines included around `list-matching-lines' matches. |