Function: tcl-figure-type
tcl-figure-type is a byte-compiled function defined in tcl.el.gz.
Signature
(tcl-figure-type)
Documentation
Determine type of sexp at point.
This is either tcl-expr, tcl-commands, or nil. Puts point at start
of sexp that indicates types.
See documentation for variable tcl-type-alist for more information.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/tcl.el.gz
(defun tcl-figure-type ()
"Determine type of sexp at point.
This is either `tcl-expr', `tcl-commands', or nil. Puts point at start
of sexp that indicates types.
See documentation for variable `tcl-type-alist' for more information."
(let ((count 0)
result
word-stack)
(while (and (< count 5)
(not result))
(condition-case nil
(progn
;; FIXME should use "tcl-backward-sexp", which would skip
;; over entire variables, etc.
(backward-sexp)
(if (looking-at "[a-zA-Z_]+")
(let ((list tcl-type-alist)
entry)
(setq word-stack (cons (tcl-word-no-props) word-stack))
(while (and list (not result))
(setq entry (car list))
(setq list (cdr list))
(let ((index 0))
(while (and entry (<= index count))
;; Abort loop if string does not match word on
;; stack.
(and (stringp (car entry))
(not (string= (car entry)
(nth index word-stack)))
(setq entry nil))
(setq entry (cdr entry))
(setq index (1+ index)))
(and (> index count)
(not (stringp (car entry)))
(setq result (car entry)))
)))
(setq word-stack (cons nil word-stack))))
(error nil))
(setq count (1+ count)))
(and tcl-explain-indentation
(message "Indentation type %s" result))
result))