--- readline-orig.scm	2006-10-21 19:02:23.000000000 -0400
+++ readline.scm	2006-10-21 19:51:36.000000000 -0400
@@ -321,6 +321,7 @@
 {
 	char *empty_prompt;
 	int prompt_len;
+	HIST_ENTRY *h;
 
 	if (gnu_readline_buf != NULL) {
 		free(gnu_readline_buf);
@@ -332,8 +333,12 @@
 	else
 		gnu_readline_buf = readline(prompt2);
 
-	if (gnu_readline_buf != NULL && *gnu_readline_buf != '\0') 
-		add_history(gnu_readline_buf);
+	if (gnu_readline_buf != NULL && *gnu_readline_buf != '\0') {
+		h = history_get(history_base + history_length - 1);
+		if (NULL == h || 0 != strcmp(h->line, gnu_readline_buf)) {
+			add_history(gnu_readline_buf);
+		}
+	}
 
 	gnu_readline_paren_balance += gnu_readline_match_balance('(', ')');
 	gnu_readline_brace_balance += gnu_readline_match_balance('[', ']');
