[Top][All Lists]

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

Re: Ignoring entries starting with space

From: Juri Linkov
Subject: Re: Ignoring entries starting with space
Date: Thu, 25 Jun 2009 23:45:16 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.93 (x86_64-pc-linux-gnu)

> 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'

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

reply via email to

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