Function: prolog-pred-end
prolog-pred-end is a byte-compiled function defined in prolog.el.gz.
Signature
(prolog-pred-end)
Documentation
Return the position at the end of the last clause of the current predicate.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/prolog.el.gz
(defun prolog-pred-end ()
"Return the position at the end of the last clause of the current predicate."
;; FIXME: Use SMIE.
(save-excursion
(goto-char (prolog-clause-end)) ; If we are before the first predicate.
(goto-char (prolog-clause-start))
(let* ((pinfo (prolog-clause-info))
(predname (nth 0 pinfo))
(arity (nth 1 pinfo))
oldp
(notdone t)
(op (point)))
(if (looking-at "[:?]-")
;; This was a directive
(progn
(if (and (eq prolog-system 'mercury)
(looking-at
(format ":-[ \t]*\\(pred\\|mode\\)[ \t]+\\(\\(?:%s\\)+\\)"
prolog-atom-regexp)))
;; Skip predicate declarations
(progn
(setq predname (buffer-substring-no-properties
(match-beginning 2) (match-end 2)))
(while (re-search-forward
(format
"\n*\\(:-[ \t]*\\(pred\\|mode\\)[ \t]+\\)?%s[( \t]"
predname)
nil t))))
(goto-char (prolog-clause-end))
(setq op (point)))
;; It was not a directive, find the last clause
(while (and notdone
(re-search-forward
(format "^%s\\([(\\.]\\| *%s\\)"
predname prolog-head-delimiter) nil t)
(= arity (nth 1 (prolog-clause-info))))
(setq oldp (point))
(setq op (prolog-clause-end))
(if (>= oldp op)
;; End of clause not found.
(setq notdone nil)
;; Continue while loop
(goto-char op))))
op)))