Function: python-nav--syntactically
python-nav--syntactically is a byte-compiled function defined in
python.el.gz.
Signature
(python-nav--syntactically FN POSCOMPFN &optional CONTEXTFN)
Documentation
Move point using FN avoiding places with specific context.
FN must take no arguments. POSCOMPFN is a two arguments function
used to compare current and previous point after it is moved
using FN, this is normally a less-than or greater-than
comparison. Optional argument CONTEXTFN defaults to
python-syntax-context-type and is used for checking current
point context, it must return a non-nil value if this point must
be skipped.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defun python-nav--syntactically (fn poscompfn &optional contextfn)
"Move point using FN avoiding places with specific context.
FN must take no arguments. POSCOMPFN is a two arguments function
used to compare current and previous point after it is moved
using FN, this is normally a less-than or greater-than
comparison. Optional argument CONTEXTFN defaults to
`python-syntax-context-type' and is used for checking current
point context, it must return a non-nil value if this point must
be skipped."
(let ((contextfn (or contextfn 'python-syntax-context-type))
(start-pos (point-marker))
(prev-pos))
(catch 'found
(while t
(let* ((newpos
(and (funcall fn) (point-marker)))
(context (funcall contextfn)))
(cond ((and (not context) newpos
(or (and (not prev-pos) newpos)
(and prev-pos newpos
(funcall poscompfn newpos prev-pos))))
(throw 'found (point-marker)))
((and newpos context)
(setq prev-pos (point)))
(t (when (not newpos) (goto-char start-pos))
(throw 'found nil))))))))