sweeprolog-clause-default-face)))))
+(ert-deftest complete-variable ()
+ "Test marking completing variable names."
+ (let ((temp (make-temp-file "sweeprolog-test"
+ nil
+ ".pl"
+ "
+baz(Baz) :- bar(B).
+"
+ )))
+ (find-file-literally temp)
+ (sweeprolog-mode)
+ (goto-char (point-max))
+ (backward-word)
+ (forward-word)
+ (call-interactively #'complete-symbol)
+ (should (string= (buffer-string)
+ "
+baz(Baz) :- bar(Baz).
+"
+ ))))
+
(ert-deftest mark-predicate ()
"Test marking predicate definition."
(let ((temp (make-temp-file "sweeprolog-test"
(push (match-string-no-properties 0) vars)))))))
vars))
+(defun sweeprolog--char-uppercase-p (char)
+ (if (fboundp 'char-uppercase-p)
+ (char-uppercase-p char)
+ (cond ((unicode-property-table-internal 'lowercase)
+ (characterp (get-char-code-property char 'lowercase)))
+ ((and (>= char ?A) (<= char ?Z))))))
+
(defun sweeprolog-variable-completion-at-point ()
"Prolog variable name completion backend for `completion-at-point'."
(when-let ((bounds (bounds-of-thing-at-point 'symbol))
(end (cdr bounds)))
(when (and (<= beg (point) end)
(let ((first (char-after beg)))
- (or (char-uppercase-p first)
+ (or (sweeprolog--char-uppercase-p first)
(= first ?_))))
(when-let ((col (sweeprolog-local-variables-collection
(buffer-substring-no-properties beg end))))