ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RP] patch: support for "configure --disable-history"


From: Thien-Thi Nguyen
Subject: [RP] patch: support for "configure --disable-history"
Date: Sat Oct 4 18:53:07 2003

greetings,

thanks for writing ratpoison.  de-rodentization complete!

i submit below for your consideration a patch that allows the
history support to be disabled by "./configure --disable-history"
(the rationale being that anything w/ a tail has rat nature and
must therefore be disdainable ;-).  the default behavior is not
changed, however.

prior to the patch is the accompanying ChangeLog entry.

thi


_________________________________________________
2003-09-04  Thien-Thi Nguyen  <address@hidden>

        * 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.


_________________________________________________________
cvs diff
cvs server: Diffing .
Index: AUTHORS
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/AUTHORS,v
retrieving revision 1.14
diff -c -p -w -r1.14 AUTHORS
*** AUTHORS     8 Aug 2003 01:40:35 -0000       1.14
--- AUTHORS     6 Sep 2003 00:05:58 -0000
*************** Pasi Kallinen <address@hidden>
*** 27,29 ****
--- 27,30 ----
  Rupert <address@hidden>
  Tim Goodwin <address@hidden>
  Joshua Neuheisel <address@hidden>
+ Thien-Thi Nguyen <address@hidden>
Index: README
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/README,v
retrieving revision 1.8
diff -c -p -w -r1.8 README
*** README      2 Mar 2001 09:45:21 -0000       1.8
--- README      6 Sep 2003 00:11:33 -0000
*************** Customization
*** 29,34 ****
--- 29,36 ----
  
  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'.
  
Index: configure.in
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/configure.in,v
retrieving revision 1.38
diff -c -p -w -r1.38 configure.in
*** configure.in        31 May 2003 09:14:27 -0000      1.38
--- configure.in        6 Sep 2003 00:05:58 -0000
*************** if test "x$no_x" = "xyes"; then
*** 63,76 ****
        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])
  fi
  
  
--- 63,83 ----
        AC_MSG_ERROR([*** Can't find X11 headers and libs])
  fi
  
! 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
  
  
cvs server: Diffing contrib
cvs server: Diffing debian
cvs server: Diffing doc
Index: doc/ratpoison.texi
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/doc/ratpoison.texi,v
retrieving revision 1.69
diff -c -p -w -r1.69 ratpoison.texi
*** doc/ratpoison.texi  23 Aug 2003 07:09:25 -0000      1.69
--- doc/ratpoison.texi  6 Sep 2003 00:05:59 -0000
*************** Yank the text from the X11 cut buffer.
*** 1157,1167 ****
  
  @item C-p
  @itemx up arrow
! Cycle backwards through the history.
  
  @item C-n
  @itemx down arrow
! Cycle forwards through the history.
  
  @item return
  submit the line of text.
--- 1157,1171 ----
  
  @item C-p
  @itemx up arrow
! Cycle backwards through the history.  (This command
! does nothing if ratpoison was configured with the
! @code{--disable-history} option.)
  
  @item C-n
  @itemx down arrow
! Cycle forwards through the history.  (This command
! does nothing if ratpoison was configured with the
! @code{--disable-history} option.)
  
  @item return
  submit the line of text.
*************** backwards through the completions.
*** 1179,1185 ****
  
  @end table
  
! 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.
--- 1183,1191 ----
  
  @end table
  
! If ratpoison was not configured with the @code{--disable-history}
! option, then
! 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.
cvs server: Diffing src
Index: src/editor.c
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/editor.c,v
retrieving revision 1.4
diff -c -p -w -r1.4 editor.c
*** src/editor.c        11 Aug 2003 00:15:12 -0000      1.4
--- src/editor.c        6 Sep 2003 00:06:00 -0000
*************** editor_backward_kill_line (rp_input_line
*** 309,314 ****
--- 309,316 ----
  static edit_status
  editor_history_previous (rp_input_line *line)
  {
+ #ifdef HAVE_READLINE_HISTORY_H
+ 
    char *entry = history_previous ();
  
    if (entry)
*************** editor_history_previous (rp_input_line *
*** 334,344 ****
--- 336,354 ----
      }
  
    return EDIT_INSERT;
+ 
+ #else /* !defined (HAVE_READLINE_HISTORY_H) */
+ 
+   return EDIT_NO_OP;
+ 
+ #endif /* !defined (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)
*************** editor_history_next (rp_input_line *line
*** 365,370 ****
--- 375,386 ----
    line->position = line->length;
  
    return EDIT_INSERT;
+ 
+ #else /* !defined (HAVE_READLINE_HISTORY_H) */
+ 
+   return EDIT_NO_OP;
+ 
+ #endif /* !defined (HAVE_READLINE_HISTORY_H) */
  }
  
  static edit_status
*************** editor_enter (rp_input_line *line)
*** 414,419 ****
--- 430,437 ----
    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));
*************** editor_enter (rp_input_line *line)
*** 430,435 ****
--- 448,454 ----
        history_add (expansion);
        line->buffer = expansion;
      }
+ #endif /* HAVE_READLINE_HISTORY_H */
  
    return EDIT_DONE;
  }
Index: src/history.c
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/history.c,v
retrieving revision 1.1
diff -c -p -w -r1.1 history.c
*** src/history.c       27 May 2003 08:22:17 -0000      1.1
--- src/history.c       6 Sep 2003 00:06:00 -0000
***************
*** 3,8 ****
--- 3,11 ----
  #include <string.h>
  
  #include "ratpoison.h"
+ 
+ #ifdef HAVE_READLINE_HISTORY_H
+ 
  #include "readline/history.h"
  
  static char *
*************** int history_expand_line (char *string, c
*** 125,127 ****
--- 128,132 ----
  {
    return history_expand (string, output);
  }
+ 
+ #endif /* HAVE_READLINE_HISTORY_H */
Index: src/main.c
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/main.c,v
retrieving revision 1.89
diff -c -p -w -r1.89 main.c
*** src/main.c  29 Aug 2003 21:17:43 -0000      1.89
--- src/main.c  6 Sep 2003 00:06:00 -0000
*************** main (int argc, char *argv[])
*** 615,621 ****
--- 615,623 ----
    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)
*************** clean_up ()
*** 768,774 ****
--- 770,778 ----
  {
    int i;
  
+ #ifdef HAVE_READLINE_HISTORY_H
    history_save ();
+ #endif /* HAVE_READLINE_HISTORY_H */
  
    free_keybindings ();
    free_aliases ();
Index: src/ratpoison.h
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/ratpoison.h,v
retrieving revision 1.24
diff -c -p -w -r1.24 ratpoison.h
*** src/ratpoison.h     17 Jul 2003 05:41:41 -0000      1.24
--- src/ratpoison.h     6 Sep 2003 00:06:00 -0000
*************** extern XGCValues gv;
*** 73,79 ****
--- 73,81 ----
  #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"
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]