GNU bug report logs - #13687
24.3.50; `read-regexp' should provide regex for symbol at point as defaults

Previous Next

Package: emacs;

Reported by: Jambunathan K <kjambunathan <at> gmail.com>

Date: Mon, 11 Feb 2013 06:30:02 UTC

Severity: wishlist

Found in version 24.3.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Jambunathan K'" <kjambunathan <at> gmail.com>, "'Juri Linkov'" <juri <at> jurta.org>
Cc: 13687 <at> debbugs.gnu.org
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,
IMHO.

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.





This bug report was last modified 12 years and 69 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.