;;; -*- Mode:Lisp; Readtable:ZL; Package:USER; Base:8; Patch-File:T -*- ;;; Patch file for System version 121.30 ;;; Reason: ;;; RH-COM-COMPLETE-FROM-HISTORY now takes a numeric argument. ;;; Example: c-3 c-! gets the third completion. ;;; RH-COM-COMPLETE-FROM-HISTORY-NEXT-COMPLETION (m-!) cycles ;;; through the completions. It wraps at the end, and also ;;; accepts numeric args (m-- m-! will go to the previous ;;; completion.) ;;; Written 12-Feb-87 13:33:28 by jrm (Joe Marshall) at site LMI Cambridge ;;; while running on Lambda Four from band 3 ;;; with Experimental System 121.26, 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, Experimental IMicro 19.0, microcode 1742, SDU Boot Tape 3.14, SDU ROM 102. ; From modified file DJ: L.WINDOW; RH.LISP#180 at 12-Feb-87 13:33:33 #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-!) (skip) (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)) (reject (1- skip) reject) (tail (zwei::history-list (rh-input-history)) (rest tail))) ((null tail) nil) (when (equalp (subseq (car tail) start end) match-string) (when (zerop reject) (return-from lookup (1+ count))) (decf reject))))) (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* (list 'complete-from-history (1- number) match-string (rh-input-history))) t) (send self :beep)))) )) ; From modified file DJ: L.WINDOW; RH.LISP#180 at 12-Feb-87 13:33:38 #8R TV#: (COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "TV"))) (COMPILER::PATCH-SOURCE-FILE "SYS: WINDOW; RH  " (defun get-next-match (history match direction) (let ((length (length match))) (do ((element (zwei::rotate-history-yank-pointer history direction) (zwei::rotate-history-yank-pointer history direction))) (()) (when (equalp (subseq element 0 length) match) (return-from get-next-match element))))) )) ; From modified file DJ: L.WINDOW; RH.LISP#180 at 12-Feb-87 13:33:45 #8R TV#: (COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "TV"))) (COMPILER::PATCH-SOURCE-FILE "SYS: WINDOW; RH  " (defun get-match (history match argument) (dotimes (count (abs argument) (zwei::history-element-set-yank-pointer history nil)) (get-next-match history match (if (minusp argument) -1 1)))) )) ; From modified file DJ: L.WINDOW; RH.LISP#180 at 12-Feb-87 13:33:48 #8R TV#: (COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "TV"))) (COMPILER::PATCH-SOURCE-FILE "SYS: WINDOW; RH  " (define-rh-command rh-com-complete-from-history-next-completion (#/meta-!) (argument) (if (and (consp *last-command-type*) (eq (car *last-command-type*) 'complete-from-history)) (let ((match (get-match (fourth *last-command-type*) (third *last-command-type*) argument))) (rh-delete-string 0 (rh-typein-pointer)) (rh-yank-from-history match) (setq *current-command-type* *last-command-type*) t) (send self :beep))) ))