diff --git a/os/CMakeLists.txt b/os/CMakeLists.txt index 782d26576..65f74a5f3 100644 --- a/os/CMakeLists.txt +++ b/os/CMakeLists.txt @@ -106,7 +106,7 @@ include(CheckVariableExists) check_function_exists( rl_begin_undo_group HAVE_RL_BEGIN_UNDO_GROUP) check_function_exists( rl_clear_pending_input HAVE_RL_CLEAR_PENDING_INPUT) check_function_exists( rl_discard_argument HAVE_RL_DISCARD_ARGUMENT) - check_function_exists( rl_filename_completion_function HAVE_RL_FILENAME_COMPLETION_FUNCTION) + check_symbol_exists( rl_filename_completion_function stdio.h;readline/readline.h HAVE_RL_FILENAME_COMPLETION_FUNCTION) check_function_exists( rl_free_line_state HAVE_RL_FREE_LINE_STATE ) check_function_exists( rl_insert_close HAVE_RL_INSERT_CLOSE ) check_function_exists( rl_reset_after_signal HAVE_RL_RESET_AFTER_SIGNAL ) diff --git a/os/YapIOConfig.h.cmake b/os/YapIOConfig.h.cmake index b5ab16c19..41d4a4a75 100644 --- a/os/YapIOConfig.h.cmake +++ b/os/YapIOConfig.h.cmake @@ -51,9 +51,9 @@ you don't. */ #cmakedefine HAVE_RL_CLEAR_PENDING_INPUT ${HAVE_RL_CLEAR_PENDING_INPUT} #endif -/* Define to 1 if the system has the type `rl_completion_func_t'). */ -#ifndef HAVE_RL_COMPLETION_FUNC_T -#cmakedefine HAVE_RL_COMPLETION_FUNC_T ${HAVE_RL_COMPLETION_FUNC_T} +/* Define to 1 if the system has the type `rl_completion_entry_function'). */ +#ifndef HAVE_RL_COMPLETION_ENTRY_FUNCTION +#cmakedefine HAVE_RL_COMPLETION_ENTRY_FUNCTION ${HAVE_RL_COMPLETION_ENTRY_FUNCTION} #endif /* Define to 1 if the system has the type `rl_completion_func_t'. */ diff --git a/os/readline.c b/os/readline.c index 5c946d825..e2e5ea65f 100644 --- a/os/readline.c +++ b/os/readline.c @@ -273,24 +273,6 @@ bool Yap_ReadlineOps(StreamDesc *s) { return false; } -static int prolog_complete(int ignore, int key) { - if (rl_point > 0 && rl_line_buffer[rl_point - 1] != ' ') { -#if HAVE_DECL_RL_CATCH_SIGNALS /* actually version >= 1.2, or true readline \ - */ - rl_begin_undo_group(); - rl_complete(ignore, key); - if (rl_point > 0 && rl_line_buffer[rl_point - 1] == ' ') { - rl_delete_text(rl_point - 1, rl_point); - rl_point -= 1; - rl_delete(-1, key); - } - rl_end_undo_group(); -#endif - } else - rl_complete(ignore, key); - - return 0; -} bool Yap_InitReadline(Term enable) { // don't call readline within emacs @@ -320,12 +302,6 @@ bool Yap_InitReadline(Term enable) { } rl_readline_name = "YAP Prolog"; rl_attempted_completion_function = prolog_completion; -#ifdef HAVE_RL_FILENAME_COMPLETION_FUNCTION - rl_add_defun("prolog-complete", prolog_complete, '\t'); -#else - rl_add_defun("prolog-complete", (void *)prolog_complete, '\t'); -#endif - // does not work // rl_prep_terminal(1); if (GLOBAL_Flags) setBooleanGlobalPrologFlag(READLINE_FLAG, true);