119 |
|
|
120 |
;; return a regexp for this prompt but with numbers replaced. |
;; return a regexp for this prompt but with numbers replaced. |
121 |
|
|
122 |
(defun split-string (s bag) |
(defun split-string-gcl (s bag) |
123 |
(cond ((equal (length s) 0) '("")) |
(cond ((equal (length s) 0) '("")) |
124 |
((string-match bag s) |
((string-match bag s) |
125 |
(if (= (match-beginning 0) 0) |
(if (= (match-beginning 0) 0) |
126 |
(cons "" (split-string (substring s (match-end 0)) bag)) |
(cons "" (split-string-gcl (substring s (match-end 0)) bag)) |
127 |
(cons (substring s 0 (match-beginning 0)) |
(cons (substring s 0 (match-beginning 0)) |
128 |
(split-string (substring s (match-end 0)) bag)))) |
(split-string-gcl (substring s (match-end 0)) bag)))) |
129 |
(t (cons s nil)))) |
(t (cons s nil)))) |
130 |
|
|
131 |
;; Return a regexp which matches the current prompt, and which |
;; Return a regexp which matches the current prompt, and which |
137 |
(defun regexp-for-this-prompt (prompt ) |
(defun regexp-for-this-prompt (prompt ) |
138 |
(let ((wild (cond ((string-match "/" prompt) "[^ >#%()]+") |
(let ((wild (cond ((string-match "/" prompt) "[^ >#%()]+") |
139 |
(t "[0-9]+")))) |
(t "[0-9]+")))) |
140 |
(let ((tem (split-string prompt wild)) (ans "")) |
(let ((tem (split-string-gcl prompt wild)) (ans "")) |
141 |
(while tem |
(while tem |
142 |
(setq ans (concat ans (regexp-quote (car tem)))) |
(setq ans (concat ans (regexp-quote (car tem)))) |
143 |
(cond ((cdr tem) (setq ans (concat ans wild)))) |
(cond ((cdr tem) (setq ans (concat ans wild)))) |