[Python-checkins] CVS: python/dist/src/Modules readline.c,2.38,2.39
Guido van Rossum
gvanrossum@users.sourceforge.net
Thu, 18 Oct 2001 18:18:45 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv2159/Modules
Modified Files:
readline.c
Log Message:
SF patch #443759: Add Interface to readline's add_history
This was submitted by Moshe, but apparently he's too busy to check it
in himself. He wrote:
Here is a function in GNU readline called add_history,
which is used to manage the history list. Though Python
uses this function internally, it does not expose it to
the Python programmer. This patch adds direct interface
to this function with documentation.
This could be used by friendly modules to "seed" the
history with commands.
Index: readline.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/readline.c,v
retrieving revision 2.38
retrieving revision 2.39
diff -C2 -d -r2.38 -r2.39
*** readline.c 2001/09/30 21:09:59 2.38
--- readline.c 2001/10/19 01:18:43 2.39
***************
*** 288,292 ****
--- 288,309 ----
set the readline word delimiters for tab-completion";
+ static PyObject *
+ py_add_history(PyObject *self, PyObject *args)
+ {
+ char *line;
+
+ if(!PyArg_ParseTuple(args, "s:add_history", &line)) {
+ return NULL;
+ }
+ add_history(line);
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ static char doc_add_history[] = "\
+ add_history(string) -> None\n\
+ add a line to the history buffer";
+
+
/* get the tab-completion word-delimiters that readline uses */
***************
*** 376,379 ****
--- 393,397 ----
{"set_completer_delims", set_completer_delims,
METH_VARARGS, doc_set_completer_delims},
+ {"add_history", py_add_history, METH_VARARGS, doc_add_history},
{"get_completer_delims", get_completer_delims,
METH_OLDARGS, doc_get_completer_delims},