Function: idlwave-fix-keywords
idlwave-fix-keywords is a byte-compiled function defined in
idlwave.el.gz.
Signature
(idlwave-fix-keywords NAME TYPE CLASS KEYWORDS &optional SUPER-CLASSES SYSTEM)
Documentation
Update a list of keywords.
Translate OBJ_NEW, adding all super-class keywords, or all keywords from all classes if CLASS equals t. If SYSTEM is non-nil, don't demand _EXTRA in the keyword list.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/idlwave.el.gz
(defun idlwave-fix-keywords (name type class keywords
&optional super-classes system)
"Update a list of keywords.
Translate OBJ_NEW, adding all super-class keywords, or all keywords
from all classes if CLASS equals t. If SYSTEM is non-nil, don't
demand _EXTRA in the keyword list."
(let ((case-fold-search t)
(idlwave--super-classes super-classes))
;; If this is the OBJ_NEW function, try to figure out the class and use
;; the keywords from the corresponding INIT method.
(if (and (equal (upcase name) "OBJ_NEW")
(derived-mode-p '(idlwave-mode idlwave-shell-mode)))
(let* ((bos (save-excursion (idlwave-beginning-of-statement) (point)))
(string (buffer-substring bos (point)))
(case-fold-search t)
class)
(and (string-match "obj_new([^'\"]*['\"]\\([a-zA-Z0-9_]+\\)"
string)
(setq class (idlwave-sintern-class (match-string 1 string)))
(setq idlwave-current-obj_new-class class)
(setq keywords
(append keywords
(idlwave-entry-keywords
(idlwave-rinfo-assq
(idlwave-sintern-method "INIT")
'fun
class
(idlwave-routines))
'do-link))))))
;; If the class is t, combine all keywords of all methods NAME
(when (eq class t)
(mapc (lambda (entry)
(and
(nth 2 entry) ; non-nil class
(eq (nth 1 entry) type) ; correct type
(setq keywords
(append keywords
(idlwave-entry-keywords entry 'do-link)))))
(idlwave-all-assq name (idlwave-routines)))
(setq keywords (idlwave-uniquify keywords)))
;; If we have inheritance, add all keywords from superclasses, if
;; the user indicated that method in `idlwave-keyword-class-inheritance'
(when (and
idlwave--super-classes
idlwave-keyword-class-inheritance
(stringp class)
(or
system
(assq (idlwave-sintern-keyword "_extra") keywords)
(assq (idlwave-sintern-keyword "_ref_extra") keywords))
;; Check if one of the keyword-class regexps matches the name
(let ((regexps idlwave-keyword-class-inheritance) re)
(catch 'exit
(while (setq re (pop regexps))
(if (string-match re name) (throw 'exit t))))))
(cl-loop for entry in (idlwave-routines) do
(and (nth 2 entry) ; non-nil class
(memq (nth 2 entry) idlwave--super-classes) ;an inherited class
(eq (nth 1 entry) type) ; correct type
(eq (car entry) name) ; correct name
(mapc (lambda (k) (add-to-list 'keywords k))
(idlwave-entry-keywords entry 'do-link))))
(setq keywords (idlwave-uniquify keywords)))
;; Return the final list
keywords))