From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.bugs Subject: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el (read-regexp): Let-bind `default' to the first Date: Mon, 04 Mar 2013 11:16:06 +0530 Message-ID: <87d2vfbtup.fsf@gmail.com> References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1362376027 20375 80.91.229.3 (4 Mar 2013 05:47:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Mar 2013 05:47:07 +0000 (UTC) Cc: 13687@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Mar 04 06:47:25 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UCOFA-00005t-5b for geb-bug-gnu-emacs@m.gmane.org; Mon, 04 Mar 2013 06:47:24 +0100 Original-Received: from localhost ([::1]:37916 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCOEo-0002lg-Pj for geb-bug-gnu-emacs@m.gmane.org; Mon, 04 Mar 2013 00:47:02 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:49857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCOEg-0002l8-Qt for bug-gnu-emacs@gnu.org; Mon, 04 Mar 2013 00:46:59 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCOEc-0001rp-9q for bug-gnu-emacs@gnu.org; Mon, 04 Mar 2013 00:46:54 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCOEc-0001rj-5Z for bug-gnu-emacs@gnu.org; Mon, 04 Mar 2013 00:46:50 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UCOEo-00084N-Dc for bug-gnu-emacs@gnu.org; Mon, 04 Mar 2013 00:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jambunathan K Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Mar 2013 05:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13687 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13687-submit@debbugs.gnu.org id=B13687.136237600630993 (code B ref 13687); Mon, 04 Mar 2013 05:47:02 +0000 Original-Received: (at 13687) by debbugs.gnu.org; 4 Mar 2013 05:46:46 +0000 Original-Received: from localhost ([127.0.0.1]:57979 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UCOEV-00083o-Vw for submit@debbugs.gnu.org; Mon, 04 Mar 2013 00:46:46 -0500 Original-Received: from mail-pb0-f46.google.com ([209.85.160.46]:51619) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UCOEP-00083X-7Y for 13687@debbugs.gnu.org; Mon, 04 Mar 2013 00:46:43 -0500 Original-Received: by mail-pb0-f46.google.com with SMTP id uo15so2884305pbc.19 for <13687@debbugs.gnu.org>; Sun, 03 Mar 2013 21:46:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=mGedQEk1aipzbaOSNwc9Z/2Uyvdjq8YjZGLjpFyBXDA=; b=AHsMf2DucIfCPNBduqXfYf+VkS3iLpY71qgSHJjgYvt6TvEbWGnkCKAUDmQSeeAKUG 6e64eH+XRXYUY9llp5YPCm1MpEdF1xYy0H8u0Nn6P86CpLshWuWBzB0Vp8KSHOqRfqmN DCdHzZxdkQRJR6qvZvmIcCLywSpBo2TtmTIVzlGubc7tLXtmlZVTB+idPo/NU1Ri03DH qVRNU7oF2Ij/2LkRA+CsnOenu+wVtg/AYjF9Xa9EF6/AROvYry8nSGGXPkgM4XRLGVft IZKozmxr1JJSOMUuqXOFvkYNI0CeVfo0nw7eEKamHIdDZI4Fy11UT0PEJUHpyDqXmXfa 1WsQ== X-Received: by 10.68.129.73 with SMTP id nu9mr26451983pbb.57.1362375978400; Sun, 03 Mar 2013 21:46:18 -0800 (PST) Original-Received: from debian-6.05 ([101.63.199.133]) by mx.google.com with ESMTPS id u10sm22588645pax.14.2013.03.03.21.46.14 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sun, 03 Mar 2013 21:46:17 -0800 (PST) In-Reply-To: <87621cfhff.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 28 Feb 2013 20:12:30 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:72057 Archived-At: Juri Linkov writes: >> 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. The question was one of how `read-regexp' should behave? If (car DEFAULTS) is nil should it offer (car SUGGESTIONS) as a default or offer an empty string for default. > > 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 :-)