diff options
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | ChangeLog | 27 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | configure.in | 25 | ||||
-rw-r--r-- | doc/ratpoison.texi | 11 | ||||
-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 |
9 files changed, 79 insertions, 12 deletions
@@ -27,3 +27,4 @@ Pasi Kallinen <pkalli@cs.joensuu.fi> Rupert <rupert.debian@hotpop.com> Tim Goodwin <tjg@star.le.ac.uk> Joshua Neuheisel <jneuheisel@msn.com> +Thien-Thi Nguyen <ttn@glug.org> @@ -1,3 +1,30 @@ +2003-11-02 Thien-Thi Nguyen <ttn@glug.org> + + * AUTHORS: Add self. + + * 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. + 2003-11-01 Shawn Betts <sabetts@vcn.bc.ca> * src/input.c (cook_keycode): null terminate the string. @@ -29,6 +29,8 @@ Customization Use the configure option '--enable-debug' to enable debugging symbols. +Use the configure option '--disable-history' to disable the filesystem rat. + Use the configure option '--with-xterm=PROG' to set the x terminal emulator to use. The default is `xterm'. diff --git a/configure.in b/configure.in index 961523c..6d58f3a 100644 --- a/configure.in +++ b/configure.in @@ -17,7 +17,7 @@ dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA dnl -dnl $Id: configure.in,v 1.38 2003/05/31 09:14:27 sabetts Exp $ +dnl $Id: configure.in,v 1.39 2003/11/03 03:17:59 sabetts Exp $ AC_INIT(src/main.c) AM_INIT_AUTOMAKE(ratpoison, 1.3.0-cvs) @@ -63,17 +63,24 @@ if test "x$no_x" = "xyes"; then AC_MSG_ERROR([*** Can't find X11 headers and libs]) fi -dnl Just a hack .... -AC_CHECK_LIB(history, add_history, [ AC_CHECK_HEADER(readline/history.h, HISTORY="yes")]) - -if test "x$HISTORY" = "xyes"; then - LIBS="$LIBS -lhistory" -else - AC_MSG_ERROR([*** Can't find History headers and libs]) +dnl Those who do not learn the lessons of history +dnl are doomed to delete it... yuk yuk. --ttn +AC_ARG_ENABLE(history, + [ --disable-history ignore libhistory (default: use it)], + [ if test x${enableval} = xyes ; then + check_for_libhistory=yes + else + check_for_libhistory=no + fi],[check_for_libhistory=yes]) + +if test x$check_for_libhistory = xyes ; then + AC_CHECK_HEADERS([readline/history.h]) + AC_CHECK_LIB(history, add_history, + LIBS="$LIBS -lhistory", + AC_MSG_ERROR([*** Can't find History headers and libs])) fi - LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS $X_EXTRA_LIBS" CFLAGS="$CFLAGS $X_CFLAGS" diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi index e47d6e0..7d7eec4 100644 --- a/doc/ratpoison.texi +++ b/doc/ratpoison.texi @@ -1177,11 +1177,15 @@ Yank the text from the X11 cut buffer. @item C-p @itemx up arrow -Cycle backwards through the history. +Cycle backwards through the history (This command does nothing if +ratpoison was configured with the @code{--disable-history} configure +option). @item C-n @itemx down arrow -Cycle forwards through the history. +Cycle forwards through the history (This command does nothing if +ratpoison was configured with the @code{--disable-history} configure +option). @item return submit the line of text. @@ -1202,7 +1206,8 @@ backwards through the completions. All input is stored in the same history list. By default ratpoison has a history length of 100 entries. This history is saved to the file @file{~/.ratpoison_history} and is loaded when you start -ratpoison. This means your history sticks between sessions. +ratpoison. This means your history sticks between sessions. This +assumes history has not been disabled on compilation. @node Command Line Arguments, Startup file, Input, Top @chapter Command Line Arguments 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" |