Function: idlwave-last-valid-char

idlwave-last-valid-char is a byte-compiled function defined in idlwave.el.gz.

Signature

(idlwave-last-valid-char)

Documentation

Return the last character before point which is not white or a comment and also not part of the current identifier. Since we do this in order to identify places where keywords are, we consider the initial
/ of a keyword as part of the identifier.
This function is not general, can only be used for completion stuff.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/idlwave.el.gz
(defun idlwave-last-valid-char ()
  "Return the last character before point which is not white or a comment
and also not part of the current identifier.  Since we do this in
order to identify places where keywords are, we consider the initial
`/' of a keyword as part of the identifier.
This function is not general, can only be used for completion stuff."
  (catch 'exit
    (save-excursion
      ;; skip the current identifier
      (skip-chars-backward "a-zA-Z0-9_$")
      ;; also skip a leading slash which might be belong to the keyword
      (if (eq (preceding-char) ?/)
	  (backward-char 1))
      ;; FIXME: does not check if this is a valid identifier
      (while t
	(skip-chars-backward " \t")
	(cond
	 ((memq (preceding-char) '(?\; ?\$)) (throw 'exit nil))
	 ((eq (preceding-char) ?\n)
	  (beginning-of-line 0)
	  (if (looking-at "\\([^\n]*\\)\\$[ \t]*\\(;[^\n]*\\)?\n")
	      ;; continuation line
	      (goto-char (match-end 1))
	    (throw 'exit nil)))
	 (t (throw 'exit (preceding-char))))))))