diff options
author | sabetts <sabetts> | 2003-11-03 03:17:51 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2003-11-03 03:17:51 +0000 |
commit | c1c11da66b23e72c0820be0eb47fdd864eea8f53 (patch) | |
tree | c8b2f1cf0407e53174a9c81364ec376cb4956afc /src | |
parent | cafd2e3f092ee5d694520c31cfbd33abcf1af843 (diff) | |
download | ratpoison-c1c11da66b23e72c0820be0eb47fdd864eea8f53.zip |
* configure.in: Add "--disable-history" handling.
Conditionalize libhistory checks accordingly.
* README: Mention "--disable history".
* src/history.c: Surround most of the code with
"#ifdef HAVE_READLINE_HISTORY_H".
* src/ratpoison.h: Only #include history.h when
"#ifdef HAVE_READLINE_HISTORY_H".
* src/main.c (main, clean_up): Only load and save history,
respectively, when "#ifdef HAVE_READLINE_HISTORY_H".
* src/editor.c (editor_history_previous, editor_history_next):
Return EDIT_NO_OP when not "#ifdef HAVE_READLINE_HISTORY_H".
(editor_enter): Do not do line expansion or history add
when not "#ifdef HAVE_READLINE_HISTORY_H".
* doc/ratpoison.texi: Mention that history cycling and
processing is not available when ratpoison is configured
with the "--disable-history" option.
Diffstat (limited to 'src')
-rw-r--r-- | src/editor.c | 14 | ||||
-rw-r--r-- | src/history.c | 5 | ||||
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/ratpoison.h | 2 |
4 files changed, 25 insertions, 0 deletions
diff --git a/src/editor.c b/src/editor.c index 1a76170..4864e80 100644 --- a/src/editor.c +++ b/src/editor.c @@ -309,6 +309,7 @@ editor_backward_kill_line (rp_input_line *line) static edit_status editor_history_previous (rp_input_line *line) { +#ifdef HAVE_READLINE_HISTORY_H char *entry = history_previous (); if (entry) @@ -334,11 +335,18 @@ editor_history_previous (rp_input_line *line) } return EDIT_INSERT; + +#else /* HAVE_READLINE_HISTORY_H */ + + return EDIT_NO_OP; + +#endif /* HAVE_READLINE_HISTORY_H */ } static edit_status editor_history_next (rp_input_line *line) { +#ifdef HAVE_READLINE_HISTORY_H char *entry = history_next (); if (entry) @@ -365,6 +373,10 @@ editor_history_next (rp_input_line *line) line->position = line->length; return EDIT_INSERT; + +#else /* HAVE_READLINE_HISTORY_H */ + return EDIT_NO_OP; +#endif /* HAVE_READLINE_HISTORY_H */ } static edit_status @@ -414,6 +426,7 @@ editor_enter (rp_input_line *line) char *expansion; line->buffer[line->length] = '\0'; +#ifdef HAVE_READLINE_HISTORY_H result = history_expand_line (line->buffer, &expansion); PRINT_DEBUG (("History Expansion - result: %d\n", result)); @@ -430,6 +443,7 @@ editor_enter (rp_input_line *line) history_add (expansion); line->buffer = expansion; } +#endif /* HAVE_READLINE_HISTORY_H */ return EDIT_DONE; } diff --git a/src/history.c b/src/history.c index 20da719..fd3e424 100644 --- a/src/history.c +++ b/src/history.c @@ -3,6 +3,9 @@ #include <string.h> #include "ratpoison.h" + +#ifdef HAVE_READLINE_HISTORY_H + #include "readline/history.h" static char * @@ -125,3 +128,5 @@ int history_expand_line (char *string, char **output) { return history_expand (string, output); } + +#endif /* HAVE_READLINE_HISTORY_H */ @@ -618,7 +618,9 @@ main (int argc, char *argv[]) init_frame_lists (); update_modifier_map (); initialize_default_keybindings (); +#ifdef HAVE_READLINE_HISTORY_H history_load (); +#endif /* HAVE_READLINE_HISTORY_H */ /* Scan for windows */ if (screen_arg) @@ -771,7 +773,9 @@ clean_up () { int i; +#ifdef HAVE_READLINE_HISTORY_H history_save (); +#endif /* HAVE_READLINE_HISTORY_H */ free_keymaps (); free_aliases (); diff --git a/src/ratpoison.h b/src/ratpoison.h index 34f528e..5d4bd7b 100644 --- a/src/ratpoison.h +++ b/src/ratpoison.h @@ -73,7 +73,9 @@ extern XGCValues gv; #include "screen.h" #include "group.h" #include "editor.h" +#ifdef HAVE_READLINE_HISTORY_H #include "history.h" +#endif /* HAVE_READLINE_HISTORY_H */ #include "completions.h" #include "hook.h" |