From: Eshel Yaron Date: Sat, 19 Nov 2022 19:46:29 +0000 (+0200) Subject: Don't error in sweeprolog-analyze-term-at-point X-Git-Tag: V8.5.20-sweep-0.8.9~4 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c131fdd5a5b8e598b2e3946ba523fac721ee6a66;p=sweep.git Don't error in sweeprolog-analyze-term-at-point --- diff --git a/sweeprolog.el b/sweeprolog.el index 8e116e8..76a1a27 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -872,8 +872,9 @@ module name, F is a functor name and N is its arity." `("head" ,_ ,f ,a) `("goal" ,_ ,f ,a)) (setq id-at-point (list f a))))))) - (sweeprolog--query-once "sweep" "sweep_functor_arity_pi" - id-at-point))))) + (when id-at-point + (sweeprolog--query-once "sweep" "sweep_functor_arity_pi" + id-at-point)))))) ;;;; Modules @@ -2633,9 +2634,10 @@ of them signal success by returning non-nil." (not (looking-at-p (rx bol (or "%" "/*")))))) (defun sweeprolog-analyze-term-at-point (cb) - (add-hook 'sweeprolog-analyze-region-fragment-hook cb nil t) - (sweeprolog-analyze-term (point)) - (remove-hook 'sweeprolog-analyze-region-fragment-hook cb t)) + (let ((sweeprolog--analyze-point (point))) + (add-hook 'sweeprolog-analyze-region-fragment-hook cb nil t) + (sweeprolog-analyze-term (point)) + (remove-hook 'sweeprolog-analyze-region-fragment-hook cb t))) (defun sweeprolog-definition-at-point (&optional point) (save-excursion