[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ping: [patch] proof of concept implementation for dabbrev-expand for rea
ping: [patch] proof of concept implementation for dabbrev-expand for readline
Fri, 13 Jul 2007 08:32:04 -0700
I originally posted this 2 1/2 month ago and I did not get any
Is there anything I can do to get a bit of attention on this issue?
Do I need to better present the advantages of having a dabbrev-expand
implementation in readline/bash?
Did this simply slip through the cracks?
Please let me know what I need to do in order to at least have this
feature discussed and accepted/rejected in principle and I will try to
PS: Here is the original message on this topic:
--- forwarded message ---
IMO a dabbrev-expand implementation in readline would be a good idea.
In emacs dabbrev-expand is bound by default to M-/
(AFAIK emacs had the original implementation for this idea. It is now
present in tcsh too)
What dabbrev-expand could do in readline/bash is to complete the word
the cursor is currently on with an item from history. Repeated
invocations complete with other matching items from history.
I have changed the implementation of "menu-complete" to behave like
"dabbrev-expand", i.e. complete with items from history.
Here is my proof of concept patch. It's a bit of a hack because
(among other things) history_completion_generator is only available in
bash, but not in readline. It could probably be moved to readline.
I am not sure what is the best way to integrate this in readline, so
for now I just made "menu-complete" do what dabbrev-expand is supposed
To test this, just do:
Can you please integrate this (or something similar) in readline/bash?
I could help with the needed code...
diff -rup ../bash-3.2.orig/bashline.c ./bashline.c
--- ../bash-3.2.orig/bashline.c 2006-07-29 13:39:30.000000000 -0700
+++ ./bashline.c 2007-04-05 13:42:22.000000000 -0700
@@ -116,7 +116,7 @@ static char *hostname_completion_functio
static char *command_subst_completion_function __P((const char *, int));
static void build_history_completion_array __P((void));
-static char *history_completion_generator __P((const char *, int));
+char *history_completion_generator __P((const char *, int));
static int dynamic_complete_history __P((int, int));
static void initialize_hostname_list __P((void));
@@ -2466,7 +2466,7 @@ build_history_completion_array ()
-static char *
history_completion_generator (hint_text, state)
const char *hint_text;
diff -rup ../bash-3.2.orig/lib/readline/complete.c ./lib/readline/complete.c
--- ../bash-3.2.orig/lib/readline/complete.c 2006-07-28
+++ ./lib/readline/complete.c 2007-04-14
@@ -2112,6 +2112,7 @@ int
rl_menu_complete (count, ignore)
int count, ignore;
+ extern char *history_completion_generator __P((const char *, int));
int matching_filenames, found_quote;
@@ -2135,12 +2136,17 @@ rl_menu_complete (count, ignore)
match_list_index = match_list_size = 0;
matches = (char **)NULL;
+ rl_filename_completion_desired = 0;
+ rl_attempted_completion_function = NULL;
/* Only the completion entry function can change these. */
- set_completion_defaults ('%');
+ set_completion_defaults ('@');
- our_func = rl_completion_entry_function
- ? rl_completion_entry_function
- : rl_filename_completion_function;
+ our_func = history_completion_generator;
+/* rl_completion_entry_function */
+/* ? rl_completion_entry_function */
/* We now look backwards for the start of a filename/variable word. */
orig_end = rl_point;
- ping: [patch] proof of concept implementation for dabbrev-expand for readline,
Dan Nicolaescu <=