Function: idlwave-complete-structure-tag
idlwave-complete-structure-tag is an interactive and byte-compiled
function defined in idlw-complete-structtag.el.gz.
Signature
(idlwave-complete-structure-tag)
Documentation
Complete a structure tag.
This works by looking in the current file for a structure assignment to a variable with the same name and takes the tags from there. Quite useful for big structures like the state variables of a widget application.
In the idlwave shell, the current content of the variable is used to get an up-to-date completion list.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/idlw-complete-structtag.el.gz
(defun idlwave-complete-structure-tag ()
"Complete a structure tag.
This works by looking in the current file for a structure assignment to a
variable with the same name and takes the tags from there. Quite useful
for big structures like the state variables of a widget application.
In the idlwave shell, the current content of the variable is used to get
an up-to-date completion list."
(interactive)
(let ((pos (point))
start
(case-fold-search t))
(if (save-excursion
;; Check if the context is right.
;; In the shell, this could be extended to expressions like
;; x[i+4].name.g*. But it is complicated because we would have
;; to really parse this expression. For now, we allow only
;; substructures, like "aaa.bbb.ccc.ddd"
(skip-chars-backward "a-zA-Z0-9._$")
(setq start (point)) ;; remember the start of the completion pos.
(and (< (point) pos)
(not (equal (char-before) ?!)) ; no sysvars
(looking-at "\\([a-zA-Z][.a-zA-Z0-9_]*\\)\\.")
(>= pos (match-end 0))
(not (string= (downcase (match-string 1)) "self"))))
(let* ((var (downcase (match-string 1))))
;; Check if we need to update the "current" structure. Basically we
;; do it always, except for subsequent completions at the same
;; spot, to save a bit of time. Implementation: We require
;; an update if
;; - the variable is different or
;; - the buffer is different or
;; - we are completing at a different position
(if (or (not (string= var (or idlwave-current-tags-var "@")))
(not (eq (current-buffer) idlwave-current-tags-buffer))
(not (equal start idlwave-current-tags-completion-pos)))
(idlwave-prepare-structure-tag-completion var))
(setq idlwave-current-tags-completion-pos start)
(setq idlwave-completion-help-info
(list 'idlwave-complete-structure-tag-help))
(idlwave-complete-in-buffer 'structtag 'structtag
idlwave-current-struct-tags nil
"Select a structure tag" "structure tag")
t) ; we did the completion: return t to skip other completions
nil))) ; return nil to allow looking for other ways to complete