;;; -*- Mode:Lisp; Readtable:ZL; Package:USER; Base:8; Patch-File:T -*-
;;; Patch file for System version 121.26
;;; Reason:
;;;  *New* *Improved* rubout handler command c-sh-! (control exclamation)
;;;  RH-COM-COMPLETE-FROM-HISTORY completes the typein so far with a match
;;;  from the typein history.
;;; Written 9-Feb-87 15:56:08 by jrm (Joe Marshall) at site LMI Cambridge
;;; while running on Laurie Anderson from band 2
;;; with Experimental System 121.22, Experimental Lambda-Diag 15.0, Experimental ZMail 70.2, Experimental KERMIT 32.0, Experimental Unix-Interface 10.0, Experimental Local-File 72.0, Experimental FILE-Server 21.0, Experimental Tape 13.0, microcode 1729, SDU Boot Tape 3.14, SDU ROM 102.



; From file DJ: L.WINDOW; RH.LISP#180 at 9-Feb-87 15:56:14
#8R TV#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "TV")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: WINDOW; RH  "

(define-rh-command rh-com-complete-from-history (#/control-!) (ignore)
  (let* ((start 0)
	 (end  (rh-typein-pointer))
	 (match-string (subseq rubout-handler-buffer 0 (rh-typein-pointer)))
	 (number (do-named lookup
			   ((count 0 (1+ count))
			    (tail (zwei::history-list (rh-input-history)) (rest tail)))
			   ((null tail) nil)
		   (when (equalp (subseq (car tail) start end) match-string)
		     (return-from lookup (1+ count))))))
    (if number
	(progn (rh-delete-string start end nil)
	       (rh-yank-from-history
		 (zwei::history-element-set-yank-pointer (rh-input-history) number))
	       (setq *current-command-type* (rh-input-history))
	       t)
      (send self :beep))))

))
