unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Ignoring entries starting with space
@ 2009-06-21 21:20 Francesc Rocher
  2009-06-21 23:00 ` Juri Linkov
  2009-06-24 21:21 ` Stefan Monnier
  0 siblings, 2 replies; 13+ messages in thread
From: Francesc Rocher @ 2009-06-21 21:20 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2524 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2909 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-06-26 23:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-21 21:20 Ignoring entries starting with space Francesc Rocher
2009-06-21 23:00 ` Juri Linkov
2009-06-24 21:21 ` Stefan Monnier
2009-06-24 22:08   ` Juri Linkov
2009-06-25  7:58     ` Francesc Rocher
2009-06-25 12:44       ` Stefan Monnier
2009-06-25 20:45         ` Juri Linkov
2009-06-25 22:57           ` Stefan Monnier
2009-06-25 23:03             ` Lennart Borgman
2009-06-26 18:25               ` Francesc Rocher
2009-06-26 19:02                 ` Drew Adams
2009-06-26 22:54                 ` Juri Linkov
2009-06-26 23:42                 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).