unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Jambunathan K'" <kjambunathan@gmail.com>,
	"'Juri Linkov'" <juri@jurta.org>
Cc: 13687@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	[thread overview]
Message-ID: <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> (raw)
In-Reply-To: <87vc92gi37.fsf@gmail.com>

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






  reply	other threads:[~2013-03-08 15:29 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1UA5QC-0006Vm-Qb@vcs.savannah.gnu.org>
     [not found] ` <877glsyecw.fsf@gmail.com>
2013-02-28 18:12   ` bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): Let-bind `default' to the first Juri Linkov
2013-03-03  9:31     ` Juri Linkov
2013-03-06 18:00       ` Jambunathan K
2013-03-08 13:02       ` Jambunathan K
2013-03-08 15:29         ` Drew Adams [this message]
2013-03-08 16:53           ` bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): " Jambunathan K
2013-03-08 17:10             ` Drew Adams
2013-03-08 17:27               ` Jambunathan K
2013-03-08 17:28           ` Juri Linkov
2013-03-08 18:16             ` Drew Adams
2013-03-08 18:30               ` Jambunathan K
2013-03-08 18:53                 ` Drew Adams
2013-03-08 19:03                   ` Jambunathan K
2013-03-08 21:08                     ` Drew Adams
2013-03-09  8:47                 ` Jambunathan K
2013-03-09 15:08                   ` Drew Adams
2013-03-09 16:21                     ` Jambunathan K
2013-03-09 16:37                       ` Drew Adams
2013-03-09 16:59                         ` Jambunathan K
2013-03-09 17:14                           ` Drew Adams
2013-03-09 17:25                             ` Jambunathan K
2013-03-09 17:55                               ` Drew Adams
2013-03-10 18:28                   ` Juri Linkov
2013-03-18  7:24                     ` Jambunathan K
2013-03-04  5:46     ` bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): " Jambunathan K
2013-03-04  9:28       ` Juri Linkov
2013-03-06 18:03         ` Jambunathan K

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=13687@debbugs.gnu.org \
    --cc=juri@jurta.org \
    --cc=kjambunathan@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).