Function: idlwave-expand-keyword
idlwave-expand-keyword is a byte-compiled function defined in
idlwave.el.gz.
Signature
(idlwave-expand-keyword KEYWORD MODULE)
Documentation
Expand KEYWORD to one of the valid keyword parameters of MODULE.
KEYWORD may be an exact match or an abbreviation of a keyword. If the match is exact, KEYWORD itself is returned, even if there may be other keywords of which KEYWORD is an abbreviation. This is necessary because some system routines have keywords which are prefixes of other keywords. If KEYWORD is an abbreviation of several keywords, a list of all possible completions is returned. If the abbreviation was unique, the correct keyword is returned. If it cannot be a keyword, the function return nil. If we do not know about MODULE, just return KEYWORD literally.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/idlwave.el.gz
(defun idlwave-expand-keyword (keyword module)
"Expand KEYWORD to one of the valid keyword parameters of MODULE.
KEYWORD may be an exact match or an abbreviation of a keyword.
If the match is exact, KEYWORD itself is returned, even if there may be other
keywords of which KEYWORD is an abbreviation. This is necessary because some
system routines have keywords which are prefixes of other keywords.
If KEYWORD is an abbreviation of several keywords, a list of all possible
completions is returned.
If the abbreviation was unique, the correct keyword is returned.
If it cannot be a keyword, the function return nil.
If we do not know about MODULE, just return KEYWORD literally."
(let* ((name (car module))
(type (nth 1 module))
(class (nth 2 module))
(kwd (idlwave-sintern-keyword keyword))
(entry (idlwave-best-rinfo-assoc name type class (idlwave-routines)))
(kwd-alist (idlwave-entry-keywords entry))
(extra (or (assq (idlwave-sintern-keyword "_EXTRA") kwd-alist)
(assq (idlwave-sintern-keyword "_REF_EXTRA") kwd-alist)))
(completion-ignore-case t)
candidates)
(cond ((assq kwd kwd-alist)
kwd)
((setq candidates (all-completions kwd kwd-alist))
(if (= (length candidates) 1)
(car candidates)
candidates))
((and entry extra)
;; Inheritance may cause this keyword to be correct
keyword)
(entry
;; We do know the function, which does not have the keyword.
nil)
(t
;; We do not know the function, so this just might be a correct
;; keyword - return it as it is.
keyword))))