unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Jambunathan K <kjambunathan@gmail.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: Thu, 28 Feb 2013 20:12:30 +0200	[thread overview]
Message-ID: <87621cfhff.fsf@mail.jurta.org> (raw)
In-Reply-To: <877glsyecw.fsf@gmail.com> (Jambunathan K.'s message of "Thu, 28 Feb 2013 15:00:55 +0530")

> emacs -Q
> M-s h r
>
> I find the following error
>
> ,----
> | Debugger entered--Lisp error: (error "Regexp cannot match an empty string")
> |   signal(error ("Regexp cannot match an empty string"))
> |   error("Regexp cannot match an empty string")
> |   hi-lock-regexp-okay("")
> |   byte-code("..." [regexp-history hi-lock-regexp-okay read-regexp "Regexp to highlight" hi-lock-read-face-name] 4)
> |   call-interactively(highlight-regexp nil nil)
> |   command-execute(highlight-regexp)
> `----
>
> So, if one does
>         (read-regexp something) ;; something is nil or evals to nil
>
> what should the interpretation be.
>
> With your change, a `nil' default will provide an empty string as input
> and force user to enter a regexp or rely on M-n.
>
> We seem to be bumping in to each other in this area.  Comments ...?
>
> ,---- Stefan @ http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13687#11
> | I disagree: read-regexp is a generic function which can be used in
> | various contexts, some of which might not care at all about the text
> | around point.  So the caller should have control over the first default
> | (of course, it's perfectly fine to always add the current tag in the
> | subsequent defaults).
> |
> | This said your patch seems to leave the caller's provided `defaults' at
> | the beginning of the minibuffer's `defaults', so I think your patch is
> | fine, feel free to install it.
> `----
>
> I am wondering how we can resolve the contex-free read-regexp and
> context-dependent regexp.  Any suggestions?

It's a responsibility of the caller to provide the default value.
`M-s h r' (`highlight-regexp') provides the default value as
`(car regexp-history)'.  When it is called the first time after
`emacs -Q', the history is empty, so its default value is nil
(this fact is indicated with missing default value in the prompt,
so the user is aware that RET with empty input will do nothing.)

When `highlight-regexp' is called the second time and more,
it gets the default value from `regexp-history', so you can't
provide the tag at point as the default for later invocations
of `highlight-regexp' anyway.

So the question is: should the default value in the caller
`highlight-regexp' be changed from `(car regexp-history)'
to code that gets the tag at point?  You could propose
such a change, but since it changes the long-standing behavior,
expect some disagreement (not from me :-)





       reply	other threads:[~2013-02-28 18:12 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   ` Juri Linkov [this message]
2013-03-03  9:31     ` bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): Let-bind `default' to the first 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
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=87621cfhff.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=13687@debbugs.gnu.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).