Commit 60e22571 authored by David Byers's avatar David Byers
Browse files

Hopefully fixed bug in command completion.

parent dcaab97b
2000-09-02 David Byers <>
* completing-read.el (lyskom-completing-strip-name): Added
2000-09-02 David Byers <>
* distribution-Makefile (INFODIR): Changed to default location for
Emacs installations.
(LISPDIR): Same here.
Sat Sep 2 14:24:57 2000 David Byers <>
* slow.el (lyskom-expand-slow-command): Use
......@@ -255,24 +255,28 @@ transformed for matching."
"Look up the command that corresponds to a certain string."
(lyskom-complete-command string predicate 'lyskom-lookup))
(defsubst lyskom-command-match-string-regexp (string)
(concat "^"
(replace-in-string (regexp-quote (lyskom-unicase (lyskom-completing-strip-name string t)))
"\\s-+" "\\\\S-*\\\\s-+")
(defun lyskom-complete-command (string predicate all)
"Completion function for LysKOM commands."
(let ((alternatives nil)
(m-string (lyskom-completing-match-string-regexp string))
(m-string (lyskom-command-match-string-regexp string))
(exact nil))
(lyskom-traverse el lyskom-command-alternatives
(when (and (string-match m-string (elt el 2))
(or (null predicate) (funcall predicate el)))
(setq alternatives (cons (if (eq all 'lyskom-lookup) el (elt el 0)) alternatives))
(if (eq (match-end 0) (length (elt el 2))) (setq exact t))))
(if (eq (match-end 0) (length (elt el 2))) (setq exact el))))
((eq all 'lyskom-lookup) (elt (car alternatives) 1))
((eq all 'lambda) (or (= (length alternatives) 1) exact))
((eq all 'lyskom-lookup) (and exact (elt exact 1)))
((eq all 'lambda) exact)
(all alternatives)
((null alternatives) nil)
((= (length alternatives) 1)
(if (string-equal string (lyskom-maybe-recode-string (car alternatives)))
t (lyskom-maybe-recode-string (car alternatives))))
((and (= (length alternatives) 1) exact) t)
(t (lyskom-maybe-recode-string
(lyskom-complete-string alternatives))))))
......@@ -550,15 +550,18 @@ function work as a name-to-conf-stat translator."
(defun lyskom-completing-strip-name (string)
"Strip parens and crap from a name"
(defun lyskom-completing-strip-name (string &optional dont-strip-spaces)
"Strip parens and crap from a name.
If optional DONT-STRIP-SPACES is non-nil, don't strip spaces at front
and back of the string."
(while (string-match "([^()]*)" string)
(setq string (replace-match " " t t string)))
(while (string-match "\\s-\\s-+" string)
(setq string (replace-match " " t t string)))
(while (string-match "([^()]*$" string)
(setq string (substring string 0 (match-beginning 0))))
(if (string-match "^\\s-*\\(.*\\S-\\)\\s-*$" string)
(if (and (not dont-strip-spaces)
(string-match "^\\s-*\\(.*\\S-\\)\\s-*$" string))
(match-string 1 string)
......@@ -17,8 +17,8 @@ EMACS=emacs
# INFODIR is where documentation goes (if there is any)
# ======================================================================
# ======================================================================
......@@ -3606,7 +3606,7 @@ One parameter - the prompt string."
(lambda (x)
(aset tmp (char-to-int x) t)))
(lyskom-maybe-recode-string lyskom-line-start-chars-string 'iso-8859-1))
(lyskom-maybe-recode-string lyskom-line-start-chars-string 'iso-8859-1 t))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment