]> git.eshelyaron.com Git - dict.git/commitdiff
Don't error in sweeprolog-analyze-term-at-point
authorEshel Yaron <me@eshelyaron.com>
Sat, 19 Nov 2022 19:46:29 +0000 (21:46 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sat, 19 Nov 2022 19:46:29 +0000 (21:46 +0200)
sweeprolog.el

index 8e116e81f585f0349078a81db13cda87de00634d..76a1a274b5c26c23fb3cb4920b9ed497d7bbd2ce 100644 (file)
@@ -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