Function: combobulate-forward-sexp-function

combobulate-forward-sexp-function is a natively compiled function defined in combobulate-navigation.el.

Signature

(combobulate-forward-sexp-function ARG)

Documentation

Combobulate-aware function capable of navigating by sexp.

This function must be installed in forward-sexp-function to work properly.

Source Code

;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-navigation.el
(defun combobulate-forward-sexp-function (arg)
  "Combobulate-aware function capable of navigating by sexp.

This function must be installed in `forward-sexp-function' to
work properly."
  (with-navigation-nodes (:procedures
                          (combobulate-read procedures-sexp)
                          :skip-prefix t :backward (< arg 0))
    (let ((node)
          (inc (if (> arg 0) 1 -1))
          (backward (< arg 0)))
      (while (/= arg 0)
        (unless (setq node (combobulate-forward-sexp-function-1 backward))
          ;; no node found? try harder..
          (save-excursion
            (if backward
                (progn (skip-chars-forward combobulate-skip-prefix-regexp)
                       (skip-syntax-forward ". "))
              (skip-syntax-forward ". ")
              (skip-chars-forward combobulate-skip-prefix-regexp)))
          (setq node (combobulate-forward-sexp-function-1 backward)))
        (goto-char (if node
                       (if backward
                           (combobulate-node-start node)
                         (combobulate-node-end node))
                     (or (scan-sexps (point) inc) (buffer-end inc))))
        (when backward (save-excursion (backward-prefix-chars) (point)))
        (setq arg (- arg inc))))))