Function: TeX-complete-symbol
TeX-complete-symbol is an interactive and byte-compiled function
defined in tex.el.
Signature
(TeX-complete-symbol)
Documentation
Perform completion on TeX/LaTeX symbol preceding point.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-complete-symbol ()
"Perform completion on TeX/LaTeX symbol preceding point."
(interactive "*")
(let ((entry (TeX--complete-find-entry)))
(when entry
(if (numberp (nth 1 entry))
(let* ((sub (nth 1 entry))
(close (if (and (nth 3 entry)
(listp (nth 3 entry))
(symbolp (car (nth 3 entry))))
(eval (nth 3 entry) t)
(nth 3 entry)))
(begin (match-beginning sub))
(end (match-end sub))
(pattern (TeX-match-buffer 0))
(symbol (buffer-substring begin end))
(list (funcall (nth 2 entry)))
(completion (try-completion symbol list))
(buf-name "*Completions*"))
(cond ((eq completion t)
(and close
(not (looking-at (regexp-quote close)))
(insert close))
(let ((window (get-buffer-window buf-name)))
(when window (delete-window window))))
((null completion)
(error "Can't find completion for \"%s\"" pattern))
((not (string-equal symbol completion))
(delete-region begin end)
(insert completion)
(and close
(eq (try-completion completion list) t)
(not (looking-at (regexp-quote close)))
(insert close))
(let ((window (get-buffer-window buf-name)))
(when window (delete-window window))))
(t
(completion-in-region begin end
(all-completions symbol list nil)))))
(funcall (nth 1 entry))))))