bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#7567: Please add a history variable to read-regexp


From: Drew Adams
Subject: bug#7567: Please add a history variable to read-regexp
Date: Tue, 7 Dec 2010 19:10:07 -0800

> For consistency, `read-regexp' could have the same function signature
> as other minibuffer reading functions, e.g. like `read-string':
> 
>   (read-string PROMPT &optional INITIAL-INPUT HISTORY 
> DEFAULT-VALUE INHERIT-INPUT-METHOD)
> 
>   (read-regexp PROMPT &optional INITIAL-INPUT HISTORY 
> DEFAULT-VALUE INHERIT-INPUT-METHOD)

I agree with that.  But I also think that it might be good to use
`completing-read', to allow (lax) completion against the history.  IOW, use the
history for both completion and the usual history access.

FWIW, I use completion for regexp reading, but more often against a different
set of candidates from the history.

E.g., for `icicle-customize-apropos', I use this to read a regexp that matches
an option name:

(completing-read "Customize (regexp): " obarray
                 nil nil nil 'regexp-history)

And for `icicle-find-tag' I use this to read a regexp that matches a tag:

(completing-read
  "Find tag matching regexp: "
;;; $$$ Or should we just read a regexp against `regexp-history'?
  (if (fboundp 'tags-lazy-completion-table)
      (tags-lazy-completion-table) ; Emacs 23+
    'tags-complete-tag) ; Emacs < 23
  nil nil nil 'find-tag-history
  (funcall (or find-tag-default-function
               (get major-mode 'find-tag-default-function)
               'find-tag-default)))

You can tell from the code comment here that I'm not sure the tag COLLECTION
here is better than a regexp history as COLLECTION.

(But in Icicles you can hit a key in the minibuffer to complete against the
current history, so it's usually better to offer a different set for
COLLECTION.)

Anyway, I think that Juri's proposal (built on Lennart's) would be an
improvement.






reply via email to

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