From: Eshel Yaron Date: Mon, 12 Sep 2022 07:38:40 +0000 (+0300) Subject: ADDED: (sweep-prefix-operators): New function X-Git-Tag: v0.2.1~6 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5eb4ede8f8ece589f72d3f01bb67e5470769e38d;p=dict.git ADDED: (sweep-prefix-operators): New function --- diff --git a/sweep.el b/sweep.el index 66dbb5a..9141557 100644 --- a/sweep.el +++ b/sweep.el @@ -342,6 +342,15 @@ FLAG and VALUE are specified as strings and read as Prolog terms." (forward-char)) (cons start (point)))))))) +(defun sweep-prefix-operators (&optional file) + (sweep-open-query "user" + "sweep" "sweep_prefix_ops" + (or file (buffer-file-name))) + (let ((sol (sweep-next-solution))) + (sweep-close-query) + (when (sweep-true-p sol) + (cdr sol)))) + (defun sweep-completion-at-point-function () (when-let ((bounds (sweep-predicate-prefix-boundaries))) (let ((start (car bounds)) @@ -1101,6 +1110,7 @@ Interactively, a prefix arg means to prompt for BUFFER." ((sweep-indent-line-ends-with-else point)) ((sweep-indent-line-ends-with-arg point)) ((sweep-indent-line-ends-with-neck-p) 4) + ;; ((sweep-indent-line-ends-with-prefix-operator)) (t (sweep-indent-line-fallback)))))) (defun sweep-indent-line-fallback () diff --git a/sweep.pl b/sweep.pl index 56a25be..8d62974 100644 --- a/sweep.pl +++ b/sweep.pl @@ -51,6 +51,7 @@ sweep_modules_collection/2, sweep_packs_collection/2, sweep_pack_install/2, + sweep_prefix_ops/2, sweep_module_path/2 ]). @@ -668,6 +669,15 @@ should_handle_message_kind(warning, "warning"). should_handle_message_kind(informational, "informational"). should_handle_message_kind(debug(Topic0), ["debug"|Topic]) :- atom_string(Topic0, Topic). +sweep_prefix_ops(Path0, Ops) :- + atom_string(Path, Path0), + findall(Op, current_op(_, fx, Op), Ops0, Tail0), + findall(Op, current_op(_, fy, Op), Tail0, Tail1), + findall(Op, xref_op(Path, op(_, fx, Op)), Tail1, Tail), + findall(Op, xref_op(Path, op(_, fy, Op)), Tail), + maplist(atom_string, Ops0, Ops1), + list_to_set(Ops1, Ops). + sweep_load_buffer([String|Path0], Result) :- atom_string(Path, Path0), with_buffer_stream(Stream,