[Top][All Lists]

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

bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp):

From: Drew Adams
Subject: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first
Date: Fri, 8 Mar 2013 07:29:52 -0800

> > 2. Add a new defcustom like:
> >    (defcustom minibuffer-defaults 
> >      '((highlight-regexp-default . tag-at-point)
> >        (rgrep . history)
> >        (occur . tag-at-point)
> >        (how-many . history)
> >        ...))
> >    Cons: Too large list of commands for one option.
> I am attaching a patch that handles `occur'.
> I will commit this patch tomorrow.

Sorry, I have not been following this thread at all - please excuse any jumping
to wrong conclusions.

If that defcustom is what it looks like to me, I'd say that such an approach is
quite misguided.  I.e., if you are defining a user option that globally controls
defaulting for commands reading input from the minibuffer, that's a bad idea,

Let the command decide its own defaulting.  Individual commands that read the
minibuffer should control such defaulting, at the point of call.

They can rely on user options if they want to.  But a single user option for
this kind of thing, and especially if it somehow takes control of defaulting
away from the caller (command), is a bad idea.

And doubly so if it does command lookup to determine the default value to use.
That's the real mistake, IMHO.

FWIW, in my code I do something that I'm guessing might be similar to the
_effect_ you want, but I stay completely away from command lookup/dispatching.

I have a user option, `search/replace-default-fn', whose value (a function)
provides the default value(s) for functions `query-replace', `occur',
`how-many', `flush-lines',...

This means that, a priori, the same option value is used for all such functions.
But a command can override this.  And the function that is the option value can
itself do the kind of dispatching that you are doing, if that is something the
user really wants.

code: http://www.emacswiki.org/emacs/download/replace%2b.el
doc:  http://www.emacswiki.org/cgi-bin/wiki/ReplacePlus

I also wonder whether you are perhaps changing the user experience here without
a proper proposal and discussion in emacs-devel first.  "I will
commit...tomorrow." does not inspire confidence.  How about proposing a change
and seeing what others in the development list think?

Again, if I have misunderstood, mille excuses.

reply via email to

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