Commit 0f767394 authored by Martin Panter's avatar Martin Panter

Issue #6953: Rearrange and expand Readline module documentation

* Group functions into six new subsections
* Document the underlying Readline function or variable accessed
* get_history_length() returns the history file limit
* clear_history() is conditionally compiled in
* Clarify zero and one bases for history item indexes
* parse_and_bind() uses its argument directly as an init line
* Change "command line" to "line buffer" for consistency
* read_init_file() also executes the file
* read_history_file() replaces the previous history
* write_history_file() overwrites any existing file
* Differentiate history file lines from history list items, which could be
  multi-line
* Add more information about completion, also addressing Issue #10796
* libedit (Editline) may be used on any platform; detection is OS X specific
parent cc71a795
This diff is collapsed.
...@@ -340,6 +340,10 @@ Library ...@@ -340,6 +340,10 @@ Library
Documentation Documentation
------------- -------------
- Issue #6953: Rework the Readline module documentation to group related
functions together, and add more details such as what underlying Readline
functions and variables are accessed.
- Issue #23606: Adds note to ctypes documentation regarding cdll.msvcrt. - Issue #23606: Adds note to ctypes documentation regarding cdll.msvcrt.
- Issue #25500: Fix documentation to not claim that __import__ is searched for - Issue #25500: Fix documentation to not claim that __import__ is searched for
......
...@@ -149,7 +149,7 @@ parse_and_bind(PyObject *self, PyObject *args) ...@@ -149,7 +149,7 @@ parse_and_bind(PyObject *self, PyObject *args)
PyDoc_STRVAR(doc_parse_and_bind, PyDoc_STRVAR(doc_parse_and_bind,
"parse_and_bind(string) -> None\n\ "parse_and_bind(string) -> None\n\
Parse and execute single line of a readline init file."); Execute the init line provided in the string argument.");
/* Exported function to parse a readline init file */ /* Exported function to parse a readline init file */
...@@ -174,7 +174,7 @@ read_init_file(PyObject *self, PyObject *args) ...@@ -174,7 +174,7 @@ read_init_file(PyObject *self, PyObject *args)
PyDoc_STRVAR(doc_read_init_file, PyDoc_STRVAR(doc_read_init_file,
"read_init_file([filename]) -> None\n\ "read_init_file([filename]) -> None\n\
Parse a readline initialization file.\n\ Execute a readline initialization file.\n\
The default filename is the last filename used."); The default filename is the last filename used.");
...@@ -271,7 +271,7 @@ append_history_file(PyObject *self, PyObject *args) ...@@ -271,7 +271,7 @@ append_history_file(PyObject *self, PyObject *args)
PyDoc_STRVAR(doc_append_history_file, PyDoc_STRVAR(doc_append_history_file,
"append_history_file(nelements[, filename]) -> None\n\ "append_history_file(nelements[, filename]) -> None\n\
Append the last nelements of the history list to file.\n\ Append the last nelements items of the history list to file.\n\
The default filename is ~/.history."); The default filename is ~/.history.");
#endif #endif
...@@ -290,7 +290,7 @@ set_history_length(PyObject *self, PyObject *args) ...@@ -290,7 +290,7 @@ set_history_length(PyObject *self, PyObject *args)
PyDoc_STRVAR(set_history_length_doc, PyDoc_STRVAR(set_history_length_doc,
"set_history_length(length) -> None\n\ "set_history_length(length) -> None\n\
set the maximal number of items which will be written to\n\ set the maximal number of lines which will be written to\n\
the history file. A negative length is used to inhibit\n\ the history file. A negative length is used to inhibit\n\
history truncation."); history truncation.");
...@@ -305,7 +305,7 @@ get_history_length(PyObject *self, PyObject *noarg) ...@@ -305,7 +305,7 @@ get_history_length(PyObject *self, PyObject *noarg)
PyDoc_STRVAR(get_history_length_doc, PyDoc_STRVAR(get_history_length_doc,
"get_history_length() -> int\n\ "get_history_length() -> int\n\
return the maximum number of items that will be written to\n\ return the maximum number of lines that will be written to\n\
the history file."); the history file.");
...@@ -373,7 +373,7 @@ set_startup_hook(PyObject *self, PyObject *args) ...@@ -373,7 +373,7 @@ set_startup_hook(PyObject *self, PyObject *args)
PyDoc_STRVAR(doc_set_startup_hook, PyDoc_STRVAR(doc_set_startup_hook,
"set_startup_hook([function]) -> None\n\ "set_startup_hook([function]) -> None\n\
Set or remove the startup_hook function.\n\ Set or remove the function invoked by the rl_startup_hook callback.\n\
The function is called with no arguments just\n\ The function is called with no arguments just\n\
before readline prints the first prompt."); before readline prints the first prompt.");
...@@ -390,7 +390,7 @@ set_pre_input_hook(PyObject *self, PyObject *args) ...@@ -390,7 +390,7 @@ set_pre_input_hook(PyObject *self, PyObject *args)
PyDoc_STRVAR(doc_set_pre_input_hook, PyDoc_STRVAR(doc_set_pre_input_hook,
"set_pre_input_hook([function]) -> None\n\ "set_pre_input_hook([function]) -> None\n\
Set or remove the pre_input_hook function.\n\ Set or remove the function invoked by the rl_pre_input_hook callback.\n\
The function is called with no arguments after the first prompt\n\ The function is called with no arguments after the first prompt\n\
has been printed and just before readline starts reading input\n\ has been printed and just before readline starts reading input\n\
characters."); characters.");
...@@ -421,7 +421,7 @@ get_begidx(PyObject *self, PyObject *noarg) ...@@ -421,7 +421,7 @@ get_begidx(PyObject *self, PyObject *noarg)
PyDoc_STRVAR(doc_get_begidx, PyDoc_STRVAR(doc_get_begidx,
"get_begidx() -> int\n\ "get_begidx() -> int\n\
get the beginning index of the readline tab-completion scope"); get the beginning index of the completion scope");
/* Get the ending index for the scope of the tab-completion */ /* Get the ending index for the scope of the tab-completion */
...@@ -435,7 +435,7 @@ get_endidx(PyObject *self, PyObject *noarg) ...@@ -435,7 +435,7 @@ get_endidx(PyObject *self, PyObject *noarg)
PyDoc_STRVAR(doc_get_endidx, PyDoc_STRVAR(doc_get_endidx,
"get_endidx() -> int\n\ "get_endidx() -> int\n\
get the ending index of the readline tab-completion scope"); get the ending index of the completion scope");
/* Set the tab-completion word-delimiters that readline uses */ /* Set the tab-completion word-delimiters that readline uses */
...@@ -464,7 +464,7 @@ set_completer_delims(PyObject *self, PyObject *args) ...@@ -464,7 +464,7 @@ set_completer_delims(PyObject *self, PyObject *args)
PyDoc_STRVAR(doc_set_completer_delims, PyDoc_STRVAR(doc_set_completer_delims,
"set_completer_delims(string) -> None\n\ "set_completer_delims(string) -> None\n\
set the readline word delimiters for tab-completion"); set the word delimiters for completion");
/* _py_free_history_entry: Utility function to free a history entry. */ /* _py_free_history_entry: Utility function to free a history entry. */
...@@ -504,7 +504,7 @@ py_remove_history(PyObject *self, PyObject *args) ...@@ -504,7 +504,7 @@ py_remove_history(PyObject *self, PyObject *args)
int entry_number; int entry_number;
HIST_ENTRY *entry; HIST_ENTRY *entry;
if (!PyArg_ParseTuple(args, "i:remove_history", &entry_number)) if (!PyArg_ParseTuple(args, "i:remove_history_item", &entry_number))
return NULL; return NULL;
if (entry_number < 0) { if (entry_number < 0) {
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
...@@ -534,7 +534,7 @@ py_replace_history(PyObject *self, PyObject *args) ...@@ -534,7 +534,7 @@ py_replace_history(PyObject *self, PyObject *args)
char *line; char *line;
HIST_ENTRY *old_entry; HIST_ENTRY *old_entry;
if (!PyArg_ParseTuple(args, "is:replace_history", &entry_number, if (!PyArg_ParseTuple(args, "is:replace_history_item", &entry_number,
&line)) { &line)) {
return NULL; return NULL;
} }
...@@ -575,7 +575,7 @@ py_add_history(PyObject *self, PyObject *args) ...@@ -575,7 +575,7 @@ py_add_history(PyObject *self, PyObject *args)
PyDoc_STRVAR(doc_add_history, PyDoc_STRVAR(doc_add_history,
"add_history(string) -> None\n\ "add_history(string) -> None\n\
add a line to the history buffer"); add an item to the history buffer");
/* Get the tab-completion word-delimiters that readline uses */ /* Get the tab-completion word-delimiters that readline uses */
...@@ -588,7 +588,7 @@ get_completer_delims(PyObject *self, PyObject *noarg) ...@@ -588,7 +588,7 @@ get_completer_delims(PyObject *self, PyObject *noarg)
PyDoc_STRVAR(doc_get_completer_delims, PyDoc_STRVAR(doc_get_completer_delims,
"get_completer_delims() -> string\n\ "get_completer_delims() -> string\n\
get the readline word delimiters for tab-completion"); get the word delimiters for completion");
/* Set the completer function */ /* Set the completer function */
...@@ -649,7 +649,7 @@ get_history_item(PyObject *self, PyObject *args) ...@@ -649,7 +649,7 @@ get_history_item(PyObject *self, PyObject *args)
int idx = 0; int idx = 0;
HIST_ENTRY *hist_ent; HIST_ENTRY *hist_ent;
if (!PyArg_ParseTuple(args, "i:index", &idx)) if (!PyArg_ParseTuple(args, "i:get_history_item", &idx))
return NULL; return NULL;
#ifdef __APPLE__ #ifdef __APPLE__
if (using_libedit_emulation) { if (using_libedit_emulation) {
...@@ -741,7 +741,7 @@ insert_text(PyObject *self, PyObject *args) ...@@ -741,7 +741,7 @@ insert_text(PyObject *self, PyObject *args)
PyDoc_STRVAR(doc_insert_text, PyDoc_STRVAR(doc_insert_text,
"insert_text(string) -> None\n\ "insert_text(string) -> None\n\
Insert text into the command line."); Insert text into the line buffer at the cursor position.");
/* Redisplay the line buffer */ /* Redisplay the line buffer */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment