Function: idlwave-determine-class
idlwave-determine-class is a byte-compiled function defined in
idlwave.el.gz.
Signature
(idlwave-determine-class INFO TYPE)
Source Code
;; Defined in /usr/src/emacs/lisp/obsolete/idlwave.el.gz
(defun idlwave-determine-class (info type)
;; Determine the class of a routine call.
;; INFO is the `cw-list' structure as returned by idlwave-where.
;; The second element in this structure is the class. When nil, we
;; return nil. When t, try to get the class from text properties at
;; the arrow. When the object is "self", we use the class of the
;; current routine. otherwise prompt the user for a class name.
;; Also stores the selected class as a text property at the arrow.
;; TYPE is 'fun or 'pro.
(let* ((class (nth 2 info))
(apos (nth 3 info))
(nassoc (assoc (if (stringp (car info))
(upcase (car info))
(car info))
idlwave-query-class))
(dassoc (assq (if (car info) 'keyword-default 'method-default)
idlwave-query-class))
(query (cond (nassoc (cdr nassoc))
(dassoc (cdr dassoc))
(t t)))
(arrow (and apos (string= (buffer-substring apos (+ 2 apos)) "->")))
(is-self
(and arrow
(save-excursion (goto-char apos)
(forward-word-strictly -1)
(let ((case-fold-search t))
(looking-at "self\\>")))))
(force-query idlwave-force-class-query)
store special-class class-alist)
(cond
((null class) nil)
((eq t class)
;; There is an object which would like to know its class
(if (and arrow (get-text-property apos 'idlwave-class)
idlwave-store-inquired-class
(not force-query))
(setq class (get-text-property apos 'idlwave-class)
class (idlwave-sintern-class class)))
(if (and (eq t class) is-self)
(setq class (or (nth 2 (idlwave-current-routine)) class)))
;; Before prompting, try any special class determination routines
(when (and (eq t class)
(not force-query))
(setq special-class
(run-hook-with-args-until-success
'idlwave-determine-class-functions apos))
(if special-class
(setq class (idlwave-sintern-class special-class)
store idlwave-store-inquired-class)))
;; Prompt for a class, if we need to
(when (and (eq class t)
(or force-query query))
(setq class-alist
(mapcar #'list (idlwave-all-method-classes (car info) type)))
(setq class
(idlwave-sintern-class
(cond
((and (= (length class-alist) 0) (not force-query))
(error "No classes available with method %s" (car info)))
((and (= (length class-alist) 1) (not force-query))
(car (car class-alist)))
(t
(setq store idlwave-store-inquired-class)
(idlwave-completing-read
(format "Class%s: " (if (stringp (car info))
(format " for %s method %s"
type (car info))
""))
class-alist nil nil nil 'idlwave-class-history))))))
;; Store it, if requested
(when (and class (not (eq t class)))
;; We have a real class here
(when (and store arrow)
(condition-case ()
(add-text-properties
apos (+ apos 2)
`(idlwave-class ,class face ,idlwave-class-arrow-face
rear-nonsticky t))
(error nil)))
(setf (nth 2 info) class))
;; Return the class
class)
;; Default as fallback
(t class))))