aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorPatrick Palka <patrick@parcs.ath.cx>2015-06-02 22:49:15 -0400
committerPatrick Palka <patrick@parcs.ath.cx>2015-06-26 11:05:56 -0400
commitfc637f04c741b08726cc1631428bf094235ecb4e (patch)
tree1bb91721617e984a814138fd3fb0401af3541ba4 /gdb/doc
parent2e52ae68e7cedc3a1f9908c98ee60a8602705835 (diff)
downloadfsf-binutils-gdb-fc637f04c741b08726cc1631428bf094235ecb4e.zip
fsf-binutils-gdb-fc637f04c741b08726cc1631428bf094235ecb4e.tar.gz
fsf-binutils-gdb-fc637f04c741b08726cc1631428bf094235ecb4e.tar.bz2
Add option to remove duplicate command history entries
This patch implements the new option "history remove-duplicates", which controls the removal of duplicate history entries ("off" by default). The motivation for this option is to be able to reduce the prevalence of basic commands such as "up" and "down" in the history file. These common commands crowd out more unique commands in the history file (when the history file has a fixed size), and they make navigation of the history file via ^P, ^N and ^R more inconvenient. The option takes an integer denoting the number of history entries to look back at for a history entry that is a duplicate of the latest one. "history remove-duplicates 1" is equivalent to bash's ignoredups option, and "history remove-duplicates unlimited" is equivalent to bash's erasedups option. [ I decided to go with this integer approach instead of a tri-state enum because it's slightly more flexible and seemingly more intuitive than leave/erase/ignore. ] gdb/ChangeLog: * NEWS: Mention the new option "history remove-duplicates". * top.c (history_remove_duplicates): New static variable. (show_history_remove_duplicates): New static function. (gdb_add_history): Conditionally remove duplicate history entries. (init_main): Add "history remove-duplicates" option. gdb/doc/ChangeLog: * gdb.texinfo (Command History): Document the new option "history remove-duplicates". gdb/testsuite/ChangeLog: * gdb.base/history-duplicates.exp: New test.
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdb.texinfo15
2 files changed, 20 insertions, 0 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 6d86750..e0beb7f 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-26 Patrick Palka <patrick@parcs.ath.cx>
+
+ * gdb.texinfo (Command History): Document the new option
+ "history remove-duplicates".
+
2015-06-19 Doug Evans <dje@google.com>
* stabs.texinfo (ELF Linker Relocation): Mention Sun stabs is no
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index c9a532a..20a9563 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -22644,6 +22644,21 @@ to 256 if this variable is not set. Non-numeric values of @env{GDBHISTSIZE}
are ignored. If @var{size} is @code{unlimited} or if @env{GDBHISTSIZE} is
either a negative number or the empty string, then the number of commands
@value{GDBN} keeps in the history list is unlimited.
+
+@cindex remove duplicate history
+@kindex set history remove-duplicates
+@item set history remove-duplicates @var{count}
+@itemx set history remove-duplicates unlimited
+Control the removal of duplicate history entries in the command history list.
+If @var{count} is non-zero, @value{GDBN} will look back at the last @var{count}
+history entries and remove the first entry that is a duplicate of the current
+entry being added to the command history list. If @var{count} is
+@code{unlimited} then this lookbehind is unbounded. If @var{count} is 0, then
+removal of duplicate history entries is disabled.
+
+Only history entries added during the current session are considered for
+removal. This option is set to 0 by default.
+
@end table
History expansion assigns special meaning to the character @kbd{!}.