From 6434715829b7044081f319cd260dedef7135991b Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Mon, 26 Sep 2022 12:16:16 +0300 Subject: [PATCH] FIXED: use a more robust mechanism for finding sweep-module --- sweep.el | 21 ++++++++++----------- sweep.pl | 9 ++++++++- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/sweep.el b/sweep.el index 7ba846b..8ba8cab 100644 --- a/sweep.el +++ b/sweep.el @@ -138,17 +138,16 @@ inserted to the input history in `sweep-top-level-mode' buffers." (declare-function sweep-cleanup "sweep-module") (defun sweep--ensure-module () - (let ((swipl-lib-dir (car - (split-string-and-unquote - (shell-command-to-string - (concat - (or sweep-swipl-path (executable-find "swipl")) - " --dump-runtime-variables |" - " grep PLLIBDIR |" - " cut -f 2 -d = |" - " cut -f 1 -d ';'")))))) - (load (expand-file-name "sweep-module" swipl-lib-dir)))) - + (let ((sweep-module-path (car + (string-lines + (shell-command-to-string + (concat + (or sweep-swipl-path (executable-find "swipl")) + " -g" + " write_sweep_module_location" + " -t" + " halt")))))) + (load sweep-module-path))) (defface sweep-debug-prefix-face '((default :inherit shadow)) diff --git a/sweep.pl b/sweep.pl index de9be3e..844bd36 100644 --- a/sweep.pl +++ b/sweep.pl @@ -54,7 +54,8 @@ sweep_prefix_ops/2, sweep_op_info/2, sweep_imenu_index/2, - sweep_module_path/2 + sweep_module_path/2, + write_sweep_module_location/0 ]). :- use_module(library(pldoc)). @@ -738,3 +739,9 @@ sweep_imenu_index(Path, Index) :- term_string(PI, String) ), Index). + +write_sweep_module_location :- + absolute_file_name(foreign('sweep-module'), + Path, + [file_type(executable), access(read)]), + writeln(Path). -- 2.39.2