Add occurrence commands.
authorChris Hanson <org/chris-hanson/cph>
Thu, 9 Apr 1992 18:13:05 +0000 (18:13 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 9 Apr 1992 18:13:05 +0000 (18:13 +0000)
v7/src/edwin/edwin.pkg
v7/src/edwin/replaz.scm

index 7ce9620c73a9644c5e68dacb487a0f46c1e2f0c6..618be9876a2dcaa248a8f908317e6b48cf530761 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/edwin.pkg,v 1.86 1992/04/09 17:22:26 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/edwin.pkg,v 1.87 1992/04/09 18:12:50 cph Exp $
 
 Copyright (c) 1989-92 Massachusetts Institute of Technology
 
@@ -1043,6 +1043,7 @@ MIT in each case. |#
          edwin-command$flush-lines
          edwin-command$how-many
          edwin-command$keep-lines
+         edwin-command$list-matching-lines
          edwin-command$occur
          edwin-command$occur-mode-goto-occurrence
          edwin-mode$occur
index 3e4482251e41ed96fce5d117a377b7606aa0b9e8..b456048a0f66c897646c4a508cefa9dd641e81d6 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/replaz.scm,v 1.76 1991/09/25 18:36:03 arthur Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/replaz.scm,v 1.77 1992/04/09 18:13:05 cph Exp $
 ;;;
-;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
+;;;    Copyright (c) 1986, 1989-92 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
@@ -238,41 +238,4 @@ C-R to enter recursive edit, C-W to delete match and recursive edit,
       (push-current-mark! point)
       (if query?
          (query-loop point)
-         (replacement-loop point)))))
-\f
-;;;; Occurrence Commands
-
-(define-command count-matches
-  "Print the number of occurrences of a given regexp following point."
-  "sHow many matches for (regexp)"
-  (lambda (regexp)
-    (let* ((start (current-point))
-          (end (group-end start)))
-      (let loop ((start start) (n 0))
-       (let ((mark (re-search-forward regexp start end)))
-         (if (not mark)
-             (message (write-to-string n) " occurrences")
-             (loop mark (1+ n))))))))
-
-(define-command list-matching-lines
-  "Show all lines following point containing a match for a given regexp.
-The argument, if given, is the number of context lines to show
- on either side of each line; this defaults to zero."
-  "sList matching lines (regexp)\nP"
-  (lambda (regexp argument)
-    (let ((argument (or argument 0)))
-      (let ((end (group-end (current-point)))
-           (-arg (- argument))
-           (1+arg (1+ argument)))
-       (with-output-to-temporary-buffer "*Occur*"
-         (lambda ()
-           (define (loop start)
-             (let ((mark (re-search-forward regexp start end)))
-               (if mark
-                   (begin (write-string
-                           (extract-string (line-start mark -arg)
-                                           (line-start mark 1+arg)))
-                          (write-string "--------")
-                          (newline)
-                          (loop (line-start mark 1))))))
-           (loop (current-point))))))))
\ No newline at end of file
+         (replacement-loop point)))))
\ No newline at end of file