stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[STUMP] [PATCH] Add *input-history-ignore-duplicates* option.


From: Xan Lopez
Subject: [STUMP] [PATCH] Add *input-history-ignore-duplicates* option.
Date: Thu, 15 May 2008 18:56:35 +0100

Allows to filter duplicates in the input history list. Say, if you call three
times in a row the command 'mode-line' from C-t ;, it will only appear once in
the history list.
---
 input.lisp |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/input.lisp b/input.lisp
index b5723dd..d05d751 100644
--- a/input.lisp
+++ b/input.lisp
@@ -90,6 +90,9 @@
 (defvar *input-current-completions-idx* nil
   "The current index in the current completions list.")
 
+(defvar *input-history-ignore-duplicates* nil
+  "Do not add a command to the input history if it's already the first in the 
list.")
+
 ;;; keysym functions
 
 (defun is-modifier (keycode)
@@ -544,7 +547,9 @@ input (pressing Return), nil otherwise."
                    :error))))
     (case (process-key code state)
       (:done
-       (push (input-line-string input) *input-history*)
+       (when (or (not *input-history-ignore-duplicates*)
+                 (string/= (input-line-string input) (first *input-history*)))
+         (push (input-line-string input) *input-history*))
        :done)
       (:abort
        (throw :abort t))
-- 
1.5.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]