all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Francesc Rocher <francesc.rocher@gmail.com>
To: emacs-devel@gnu.org
Subject: Ignoring entries starting with space
Date: Sun, 21 Jun 2009 23:20:04 +0200	[thread overview]
Message-ID: <ade856a30906211420i1b199d8am6e79953f16b7d3f6@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2009-06-21 21:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-21 21:20 Francesc Rocher [this message]
2009-06-21 23:00 ` Ignoring entries starting with space 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ade856a30906211420i1b199d8am6e79953f16b7d3f6@mail.gmail.com \
    --to=francesc.rocher@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.