Skip to content

Commit

Permalink
Fixed allow type links.. make sure the help! command runs under a flag
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSPoon committed Oct 11, 2024
1 parent b3169e2 commit d1aa950
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/canary/metta_debug.pl
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
% X = 2 ;
% X = 3.
%
with_no_debug(Goal) :- is_nodebug, !, % If 'nodebug' is true, call the goal without any further option adjustments.
with_no_debug(Goal) :- is_nodebug, !, % If 'nodebug' is true, call the goal without any further option adjustments.
call(Goal).
with_no_debug(Goal) :-
% Otherwise, call the goal while modifying several debugging and execution options.
Expand All @@ -366,7 +366,7 @@
with_option(debug, silent,
with_option(e, silent,
with_option(eval, true,
with_option(exec, noskip, call(Goal)))))))).
with_option(exec, noskip, call(Goal))))))).



Expand Down
20 changes: 17 additions & 3 deletions src/canary/metta_help.pl
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
% @arg Term The term (predicate) for which help is displayed.
% @arg Arity The arity to check for.
grovel_some_help(Term, _) :-
with_no_debug(eval(['help!', Term], _)). % Evaluate the help command for the term.
xref_call(eval(['help!', Term], _)). % Evaluate the help command for the term.
grovel_some_help(Term, Arity):- number(Arity), Arity > 1,
findall(A, is_documented_arity(Term, A), ArityDoc), % Retrieve documented arities for the term.
ArityDoc \== [], % Ensure the documentation is not empty.
Expand All @@ -164,6 +164,11 @@
format('~@~n', [write_src_xref(Atom)]). % Write the source cross-reference for the atom.


%xref_call(G):- catch(G,E,debug(server(high), "xref_call ~w", [G])).
%xref_call(G):- catch(with_no_debug(G),E,debug(server(high), "xref_call ~w", [G->E])).
xref_call(G):- with_no_debug(G).
%xref_call(G):- call(G).

%! about_term(+Atom, +Term) is semidet.
%
% Determines if the Atom is about the given Term.
Expand All @@ -180,6 +185,14 @@
promiscuous_symbol('=').
promiscuous_symbol(':').

:- multifile(user:handle_msg_hook/3).
:- dynamic(user:handle_msg_hook/3).
% Save the last Msg.body Object for each method
user:handle_msg_hook(MethodStr, MsgBody, _) :- fail,
atom_string(Method,MethodStr),
nb_setval(Method, MsgBody),
fail.

%! write_src_xref(+Src) is det.
%
% Outputs source code or its reference based on the nesting of the source.
Expand All @@ -200,7 +213,8 @@
member(I, E), is_list(I), !.
maybe_link_xref(What):-
ignore(once((
clause(metta_file_buffer(_,What0,_,_,_),true,Ref),
clause(metta_file_buffer(_,What0,_,File,_),true,Ref),
symbolic(File), \+ symbol_contains(File,'stdlib_mettalog'),
alpha_unify(What,What0),
next_clause(Ref, metta_file_buffer(_,_,_,File,Loc)),
write_file_link(File,Loc)))).
Expand All @@ -214,7 +228,7 @@
nth_clause(Pred, NextIndex, NextRef),!,
clause(NextClause, _, NextRef). % Get the clause at this reference

write_file_link(File,Position):-
write_file_link(File,Position):-
stream_position_data(line_count, Position, Line), % Extract the line number.
%stream_position_data(line_position, Position, Col), % Extract the column number.
%stream_position_data(char_count, Position, CharPos), % Extract the character position.
Expand Down

0 comments on commit d1aa950

Please sign in to comment.