all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: "Drew Adams" <drew.adams@oracle.com>
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: Sat, 09 Mar 2013 00:33:56 +0530	[thread overview]
Message-ID: <87obetww6b.fsf@gmail.com> (raw)
In-Reply-To: <812C4DC04A0D46B8AC5B11170E06A75C@us.oracle.com> (Drew Adams's message of "Fri, 8 Mar 2013 10:53:54 -0800")


Suspend your judgement.  I don't like to discuss (or rather I cannot
discuss) in abstract.  It is so error prone.  I will show my wares
tomorrow.


"Drew Adams" <drew.adams@oracle.com> writes:

>> > E.g., in the code I cited, if a user does not want the same 
>> > defaulting behavior for commands `occur', `how-many', etc.,
>> > she can set option `search/replace-default-fn' to a function
>> > that distinguishes them (e.g., using `this-command', as
>> > Jambunathan suggested).
>> 
>> Interesting suggestion there.
>> 
>> This makes me think that there is no need for multiple
>> `hi-lock-read-regexp-defaults-function' and a separate
>> `occur-read-regexp-defaults-function' etc.  But a single
>> `read-regexp-defaults-function' that cases on `this-command'.
>
> The question, as I said, is whether it makes sense, for the particular commands
> that we group to use the same option, to provide the default regexp (or other
> string) in the same way.
>
> I can't speak to whether that is the case for hi-lock, occur, etc.  But if it is
> true, then yes, a single option for such a group of commands makes sense.
>
>> The function can return a symbol token like `t' for
>> `this-command's which it doesn't want to meddle with but
>> return nil or a regexp or list of regexps for commands it
>> wants to insinuate.
>
> That is not what I suggested.  I suggested that the option value be a function
> that returns a string to use as the default value when reading user input.
>
> What I said in the passage you cite is that that function (the value of the
> option) could, if the user so wants, itself test `this-command' and provide a
> different string depending on the current command.
>
>> Is there any problem with this 
>> `read-regexp-defaults-function' approach?
>
> I think you're suggesting that the option value be a function that returns t or
> nil, instead of returning a default-value string.  It's not clear to me how a
> given command such as `occur' would make use of that Boolean return value.
>
> As I noted before, I would not _encourage_ users to use a dispatching function
> as the option value, but that would not (could not) be prevented.  They can do
> anything they want using any function they want.
>
> The out-of-the-box design should make a reasonable assumption about which
> commands to group (i.e., which should use the same option).
>
> If it is expected that some command that reads a regexp would generally be
> better off with a different defaulting behavior, then that command should not
> use the group option.  It could use its own, similar option, with a different
> default option value (a different default-value-providing function).  Or it
> could hard-code its defaulting, or whatever.
>
> The use of a function to dispatch according to the current command should be
> exceptional, IMO - only a fallback possibility and not something to be
> encouraged.





  reply	other threads:[~2013-03-08 19:03 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         ` bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): " Drew Adams
2013-03-08 16:53           ` 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 [this message]
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

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

  git send-email \
    --in-reply-to=87obetww6b.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=13687@debbugs.gnu.org \
    --cc=drew.adams@oracle.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.