emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/sweeprolog 1aefaea2ab 106/166: ADDED: (sweep-find-file-at-


From: ELPA Syncer
Subject: [nongnu] elpa/sweeprolog 1aefaea2ab 106/166: ADDED: (sweep-find-file-at-point): new function
Date: Fri, 30 Sep 2022 04:59:30 -0400 (EDT)

branch: elpa/sweeprolog
commit 1aefaea2ab0d2537e816b5da37eb67658e831859
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>

    ADDED: (sweep-find-file-at-point): new function
    
    (sweep-mode): add sweep-file-at-point to file-name-at-point-functions
    buffer locally.
---
 sweep.el | 10 ++++++++++
 sweep.pl |  1 -
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/sweep.el b/sweep.el
index 16aa103c50..677a948987 100644
--- a/sweep.el
+++ b/sweep.el
@@ -1213,6 +1213,15 @@ Interactively, a prefix arg means to prompt for BUFFER."
       (when (sweep-true-p sol)
         (cdr sol)))))
 
+(defun sweep-find-file-at-point (point)
+  "Find file specificed by the Prolog file spec at POINT.
+
+Interactively, POINT is set to the current point."
+  (interactive "d" sweep-mode sweep-top-level-mode)
+  (if-let ((file (sweep-file-at-point point)))
+      (find-file file)
+    (user-error "No file specification found at point!")))
+
 (defun sweep-identifier-at-point (&optional point)
   (let* ((p (or point (point)))
          (beg (save-mark-and-excursion
@@ -1297,6 +1306,7 @@ Interactively, a prefix arg means to prompt for BUFFER."
   (sweep-colourise-buffer)
   (sweep--set-buffer-module)
   (add-hook 'xref-backend-functions #'sweep--xref-backend nil t)
+  (add-hook 'file-name-at-point-functions #'sweep-file-at-point nil t)
   (add-hook 'completion-at-point-functions 
#'sweep-completion-at-point-function nil t))
 
 ;;;; Testing:
diff --git a/sweep.pl b/sweep.pl
index d5d451fef2..56a25be01c 100644
--- a/sweep.pl
+++ b/sweep.pl
@@ -161,7 +161,6 @@ sweep_handle_file_at_point(Point, file(File), Beg, Len) :-
 sweep_handle_file_at_point(_, _, _, _).
 
 
-
 sweep_identifier_at_point([Contents0, Path, Point], Identifier) :-
     setup_call_cleanup(( new_memory_file(H),
                          insert_memory_file(H, 0, Contents0),



reply via email to

[Prev in Thread] Current Thread [Next in Thread]