emacs-devel
[Top][All Lists]
Advanced

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

Ignoring entries starting with space


From: Francesc Rocher
Subject: Ignoring entries starting with space
Date: Sun, 21 Jun 2009 23:20:04 +0200


Hello all,

The same way it is possible to delete duplicates in minibuffer history, I
think it is also very useful to have the possibility to ignore entries
starting with space(s). The new variable `history-ignore-space' would take
care of this, being `nil' its defaut value.

Here you can see the changes needed.


Index: lisp/cus-start.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/cus-start.el,v
retrieving revision 1.136
diff -u -r1.136 cus-start.el
--- lisp/cus-start.el    27 Mar 2009 16:50:25 -0000    1.136
+++ lisp/cus-start.el    21 Jun 2009 21:17:22 -0000
@@ -216,6 +216,7 @@
                  (choice (const :tag "Infinite" t) integer)
                  "22.1")
          (history-delete-duplicates minibuffer boolean "22.1")
+             (history-ignore-space minibuffer boolean "23.2")
          (read-buffer-completion-ignore-case minibuffer boolean "23.1")
 
          (minibuffer-prompt-properties
Index: src/minibuf.c
===================================================================
RCS file: /sources/emacs/emacs/src/minibuf.c,v
retrieving revision 1.362
diff -u -r1.362 minibuf.c
--- src/minibuf.c    17 Mar 2009 04:37:41 -0000    1.362
+++ src/minibuf.c    21 Jun 2009 21:17:26 -0000
@@ -61,6 +61,10 @@
 
 int history_delete_duplicates;
 
+/* No entries starting with space. */
+
+int history_ignore_space;
+
 /* Non-nil means add new input to history.  */
 
 Lisp_Object Vhistory_add_new_input;
@@ -776,6 +780,12 @@
   else
     histstring = Qnil;
 
+  /* Make sure the string must be strored.  */
+  if (history_ignore_space
+      && !NILP (histstring)
+      && SREF (histstring,0) == ' ')
+    histstring = Qnil;
+
   /* Add the value to the appropriate history list, if any.  */
   if (!NILP (Vhistory_add_new_input)
       && SYMBOLP (Vminibuffer_history_variable)
@@ -2156,6 +2166,12 @@
 elements are deleted from the history list.  */);
   history_delete_duplicates = 0;
 
+  DEFVAR_BOOL ("history-ignore-space", &history_ignore_space,
+               doc: /* *Non-nil means to ignore entries starting with space.
+If set to t, elements starting with space are not stored into the
+history list.  */);
+  history_ignore_space = 0;
+
   DEFVAR_LISP ("history-add-new-input", &Vhistory_add_new_input,
            doc: /* *Non-nil means to add new elements in history.
 If set to nil, minibuffer reading functions don't add new elements to the



If you like the idea I can install them in the trunk for release 23.2.

-- Francesc Rocher


reply via email to

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