all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Francesc Rocher <francesc.rocher@gmail.com>, emacs-devel@gnu.org
Subject: Re: Ignoring entries starting with space
Date: Thu, 25 Jun 2009 23:45:16 +0300	[thread overview]
Message-ID: <87fxdot5cl.fsf@mail.jurta.org> (raw)
In-Reply-To: <jwv4ou4o5a4.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 25 Jun 2009 14:44:11 +0200")

> Most minibuffer input is not commands but just "data" (e.g. file names).
> So maybe, you should write something more specific that only applies to
> those cases where the input takes the form of a (shell) command.
>
> Having a blanket "throw away anything startign with a space for any
> minibufffer input" sounds a bit too radical to me.  After all, bash only
> applies this rule to the history of commands, doesn't it?

This feature is useful not only for commands, but also for other
minibuffer history variables.  I use the minibuffer history lists
as "bookmarks" saved in .emacs.desktop to keep most often used items
(shell/compile/grep commands and Emacs commands, file and directory names,
search and replace strings) that can be quickly retrieved via
minibuffer history search commands.  However, this have one problem:
history lists become polluted with one-off items that are unlikely
to be reused later.  So periodically I have to purge manually the
history lists using a special command `delete-history-element'
(http://thread.gmane.org/gmane.emacs.devel/24353/focus=25269).

But this cleaning takes too much time.  Much better would be to have
a special feature to not add undesirable items to the history at all.
I am not saying that a leading space is the best way to do this.
For example, I use C-RET to quit Isearch without adding the search
string to the search ring:

(define-key isearch-mode-map [(control return)] 'isearch-exit)
(add-hook 'isearch-mode-end-hook
          (lambda ()
            ;; On typing C-RET
            (when (eq last-input-char 'C-return)
              ;; Don't add the search string to the search ring
              (if isearch-regexp
                  (setq regexp-search-ring (cdr regexp-search-ring))
                (setq search-ring (cdr search-ring))))))

So maybe a configurable key like C-RET, M-RET or S-RET could exit the
minibuffer without adding the minibuffer contents to the history
as an alternative to the leading space if typing a space character
poses a problem with completion or with file names.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=87fxdot5cl.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=francesc.rocher@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /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.