[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sweeprolog 0b054bac88 072/166: ENHANCED: better detection
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sweeprolog 0b054bac88 072/166: ENHANCED: better detection of the identifier at point |
Date: |
Fri, 30 Sep 2022 04:59:27 -0400 (EDT) |
branch: elpa/sweeprolog
commit 0b054bac88ea5a4ebf9f94862b64d892214c1e86
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>
ENHANCED: better detection of the identifier at point
---
sweep.pl | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 83 insertions(+), 2 deletions(-)
diff --git a/sweep.pl b/sweep.pl
index 61583c6284..179d5be528 100644
--- a/sweep.pl
+++ b/sweep.pl
@@ -37,6 +37,7 @@
sweep_identifier_at_point/2,
sweep_expand_file_name/2,
sweep_path_module/2,
+ sweep_colourise_query/2,
sweep_predicate_location/2,
sweep_predicates_collection/2,
sweep_modules_collection/2,
@@ -142,8 +143,83 @@ sweep_handle_identifier_at_point(Path, M, Point, Col, Beg,
Len) :-
sweep_handle_identifier_at_point_(Path, M, Col).
sweep_handle_identifier_at_point(_, _, _, _, _, _).
-sweep_handle_identifier_at_point_(Path, M0, goal_term(_Kind, Goal)) :-
+sweep_handle_identifier_at_point_(Path, M0, goal_term(Kind, Goal)) :-
!,
+ sweep_handle_identifier_at_point_goal(Path, M0, Kind, Goal).
+sweep_handle_identifier_at_point_(Path, M0, goal(Kind, Goal)) :-
+ !,
+ sweep_handle_identifier_at_point_goal(Path, M0, Kind, Goal).
+sweep_handle_identifier_at_point_(_Path, M0, head_term(_Kind, Goal)) :-
+ !,
+ sweep_handle_identifier_at_point_head(M0, Goal).
+sweep_handle_identifier_at_point_(_, _, _).
+
+
+sweep_handle_identifier_at_point_head(_, M:Goal) :-
+ !,
+ pi_head(PI, Goal),
+ asserta(sweep_current_identifier_at_point(M:PI)).
+sweep_handle_identifier_at_point_head(M, Goal) :-
+ !,
+ pi_head(PI, Goal),
+ asserta(sweep_current_identifier_at_point(M:PI)).
+
+sweep_handle_identifier_at_point_goal(_Path, M, local(_), Goal) :-
+ !,
+ pi_head(PI, Goal),
+ asserta(sweep_current_identifier_at_point(M:PI)).
+sweep_handle_identifier_at_point_goal(_Path, _M, recursion, M:Goal) :-
+ !,
+ pi_head(PI, Goal),
+ asserta(sweep_current_identifier_at_point(M:PI)).
+sweep_handle_identifier_at_point_goal(_Path, M, recursion, Goal) :-
+ !,
+ pi_head(PI, Goal),
+ asserta(sweep_current_identifier_at_point(M:PI)).
+sweep_handle_identifier_at_point_goal(_Path, _M0, built_in, Goal) :-
+ !,
+ pi_head(PI, Goal),
+ asserta(sweep_current_identifier_at_point(PI)).
+sweep_handle_identifier_at_point_goal(_Path, _M0, imported(Path), Goal) :-
+ !,
+ pi_head(PI, Goal),
+ xref_module(Path, M),
+ asserta(sweep_current_identifier_at_point(M:PI)).
+sweep_handle_identifier_at_point_goal(_Path, _M0, Extern, Goal) :-
+ sweep_is_extern(Extern, M),
+ !,
+ pi_head(PI, Goal),
+ asserta(sweep_current_identifier_at_point(M:PI)).
+sweep_handle_identifier_at_point_goal(_Path, _M0, autoload(Path), Goal) :-
+ !,
+ pi_head(PI, Goal),
+ ( '$autoload':library_index(Goal, M, Path)
+ -> true
+ ; file_name_extension(Base, _, Path), '$autoload':library_index(Goal, M,
Base)
+ ),
+ asserta(sweep_current_identifier_at_point(M:PI)).
+sweep_handle_identifier_at_point_goal(_Path, _M0, Global, Goal) :-
+ sweep_is_global(Global),
+ !,
+ pi_head(PI, Goal),
+ asserta(sweep_current_identifier_at_point(user:PI)).
+sweep_handle_identifier_at_point_goal(_Path, _M0, undefined, M:Goal) :-
+ !,
+ pi_head(PI, Goal),
+ asserta(sweep_current_identifier_at_point(M:PI)).
+sweep_handle_identifier_at_point_goal(_Path, _M0, undefined, Goal) :-
+ !,
+ pi_head(PI, Goal),
+ asserta(sweep_current_identifier_at_point(undefined:PI)).
+sweep_handle_identifier_at_point_goal(_Path, _M0, meta, _:Goal) :-
+ !,
+ pi_head(PI, Goal),
+ asserta(sweep_current_identifier_at_point(meta:PI)).
+sweep_handle_identifier_at_point_goal(_Path, _M0, meta, Goal) :-
+ !,
+ pi_head(PI, Goal),
+ asserta(sweep_current_identifier_at_point(meta:PI)).
+sweep_handle_identifier_at_point_goal(Path, M0, _Kind, Goal) :-
pi_head(PI0, Goal),
( PI0 = M:PI
-> true
@@ -156,7 +232,12 @@ sweep_handle_identifier_at_point_(Path, M0,
goal_term(_Kind, Goal)) :-
; M = M0, PI = PI0
),
asserta(sweep_current_identifier_at_point(M:PI)).
-sweep_handle_identifier_at_point_(_, _, _).
+
+sweep_is_global(global).
+sweep_is_global(global(_,_)).
+
+sweep_is_extern(extern(M), M).
+sweep_is_extern(extern(M,_), M).
sweep_colourise_some_terms([String,Path,Offset], Colors) :-
setup_call_cleanup(( new_memory_file(H),
- [nongnu] elpa/sweeprolog 5fa0e16ee3 037/166: DOC: Document sweep_funcall/2, 3 in the manual, (continued)
- [nongnu] elpa/sweeprolog 5fa0e16ee3 037/166: DOC: Document sweep_funcall/2, 3 in the manual, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 66ac977deb 045/166: Make use of the new SWI-Prolog embedded GMP handling..., ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 8f1275f113 044/166: Remove the swipl-devel git submodule, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 5dcdec144d 052/166: PORT: use swipl --dump-runtime-variables to locate SWI-Prolog.h, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog b24f66da61 051/166: Add licensing information, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 43e5cdaf91 054/166: ADDED: global keymap sweep-prefix-map, not bound by default, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 239e205add 059/166: ADDED: sweep-mode, a major mode for editing Prolog code, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog d226bbb70c 063/166: ENHANCED: set per buffer module name in sweep-mode, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog d974b0fe0a 071/166: ADDED: prepare xref backend, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 27c441ab49 068/166: PORT: don't rely on defvar-keymap available only since Emacs 29, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 0b054bac88 072/166: ENHANCED: better detection of the identifier at point,
ELPA Syncer <=
- [nongnu] elpa/sweeprolog c59ead20f7 075/166: ENHANCED: redirect Prolog messages to Emacs message function, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 031c07ac93 076/166: DOC: document the Prolog messages buffer, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 8ac0e7afb9 065/166: ENHANCED: also complete predicate names from xref, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 85ca3a5dc2 067/166: FIXED: bind SourceId in xref based completions, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 21a4475306 112/166: Makefile: Allow specifying the path to emacs, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog ec01154a41 102/166: PORT: sweep.el: require Emacs version 28 for RTLD_GLOBAL, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog e991b1a92c 097/166: ENHANCED: (sweep-load-buffer): use read-buffer to choose a buffer, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog c69c6bad3c 084/166: FIXED: correctly identify the predicate defined at start of clause, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 586521712e 110/166: DOC: README.org: add ^:{} option, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 0b545cc192 114/166: ADDED: (sweep-indent-line-ends-with-prefix-operator): New function, ELPA Syncer, 2022/09/30