Function: term-word

term-word is a byte-compiled function defined in term.el.gz.

Signature

(term-word WORD-CHARS)

Documentation

Return the word of WORD-CHARS at point, or nil if none is found.

Word constituents are considered to be those in WORD-CHARS, which is like the inside of a "[...]" (see skip-chars-forward).

Source Code

;; Defined in /usr/src/emacs/lisp/term.el.gz
(defun term-word (word-chars)
  "Return the word of WORD-CHARS at point, or nil if none is found.
Word constituents are considered to be those in WORD-CHARS, which is like the
inside of a \"[...]\" (see `skip-chars-forward')."
  (save-excursion
    (let ((limit (point))
	  (word (concat "[" word-chars "]"))
	  (non-word (concat "[^" word-chars "]")))
      (when (re-search-backward non-word nil 'move)
	(forward-char 1))
      ;; Anchor the search forwards.
      (if (or (eolp) (looking-at non-word))
	  nil
	(re-search-forward (concat word "+") limit)
	(buffer-substring (match-beginning 0) (match-end 0))))))