Add new procedure COMINT-RECORD-INPUT which is like RING-PUSH! except
authorChris Hanson <org/chris-hanson/cph>
Mon, 2 Aug 1993 02:50:40 +0000 (02:50 +0000)
committerChris Hanson <org/chris-hanson/cph>
Mon, 2 Aug 1993 02:50:40 +0000 (02:50 +0000)
that it doesn't push the string argument if it is the same as the one
on the top of the ring.  This is usually desirable -- it's not
necessary to record more than one of a series of identical commands.

v7/src/edwin/comint.scm

index 0f2c162dacc6b7a26d57a39406b6bf71713e7572..168f3ded4892bdd0412321e491320fdc5e5328ae 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: comint.scm,v 1.18 1992/11/17 17:36:00 cph Exp $
+$Id: comint.scm,v 1.19 1993/08/02 02:50:40 cph Exp $
 
 Copyright (c) 1991-1992 Massachusetts Institute of Technology
 
@@ -189,7 +189,7 @@ the input."
        (let ((point (current-point)))
          (move-mark-to! (ref-variable comint-last-input-end) point)
          (if ((ref-variable comint-input-filter) string)
-             (ring-push! (ref-variable comint-input-ring) string))
+             (comint-record-input (ref-variable comint-input-ring) string))
          ((ref-variable comint-input-sentinel) string)
          (if delete?
              (delete-string mark point)
@@ -197,6 +197,11 @@ the input."
          (move-mark-to! mark point)
          (process-send-string process (string-append string terminator)))))))
 
+(define (comint-record-input ring string)
+  (if (or (ring-empty? ring)
+         (not (string=? string (ring-ref ring 0))))
+      (ring-push! ring string)))
+\f
 (define-variable-per-buffer comint-get-old-input
   "Procedure that submits old text in comint mode.
 This procedure is called when return is typed while the point is in old text.