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, 18 Mar 2013 12:54:09 +0530 Message-ID: <87vc8pmaqu.fsf@gmail.com> References: <877glsyecw.fsf@gmail.com> <87621cfhff.fsf@mail.jurta.org> <87zjykygjk.fsf@mail.jurta.org> <87vc92gi37.fsf@gmail.com> <1751CEB23B214A3AADCCFD9F007425DE@us.oracle.com> <87li9xer9u.fsf@mail.jurta.org> <8738w5n3rg.fsf@gmail.com> <87d2v9rmcl.fsf@gmail.com> <87li9vruup.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1363591482 23136 80.91.229.3 (18 Mar 2013 07:24:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 18 Mar 2013 07:24:42 +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 18 08:25:06 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 1UHURK-0004G6-RO for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Mar 2013 08:25:03 +0100 Original-Received: from localhost ([::1]:51291 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHUQx-00056x-TM for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Mar 2013 03:24:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHUQq-00056a-2A for bug-gnu-emacs@gnu.org; Mon, 18 Mar 2013 03:24:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UHUQo-000760-Hf for bug-gnu-emacs@gnu.org; Mon, 18 Mar 2013 03:24:31 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56651) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHUQo-00075c-D2 for bug-gnu-emacs@gnu.org; Mon, 18 Mar 2013 03:24:30 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UHUSI-0003jz-20 for bug-gnu-emacs@gnu.org; Mon, 18 Mar 2013 03:26:02 -0400 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, 18 Mar 2013 07:26: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.136359154514355 (code B ref 13687); Mon, 18 Mar 2013 07:26:02 +0000 Original-Received: (at 13687) by debbugs.gnu.org; 18 Mar 2013 07:25:45 +0000 Original-Received: from localhost ([127.0.0.1]:60760 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UHUS0-0003jU-4W for submit@debbugs.gnu.org; Mon, 18 Mar 2013 03:25:44 -0400 Original-Received: from mail-da0-f45.google.com ([209.85.210.45]:35690) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UHURv-0003jA-1s for 13687@debbugs.gnu.org; Mon, 18 Mar 2013 03:25:42 -0400 Original-Received: by mail-da0-f45.google.com with SMTP id v40so1165732dad.32 for <13687@debbugs.gnu.org>; Mon, 18 Mar 2013 00:24:00 -0700 (PDT) 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=H7xDsXtZI0qknJxseg1gPlf0JdhttK3oKAshpiRD4iE=; b=qCrtLS6RcDBmH2VU7SqKN+cYn/a0Mg41X1RPUhls9gm+1Zd63aDGO5ux1XeqWiPqkU bwsAMUWgVVDhP71qdnuELvGNmv+siwb8G1/RoeWal6KdFbf/vMxAbeEDXUkLQ3sMBNPg dJS/61KM+NpLOhTg+40658mBu68X5S5JFwB6ABUAwuhH8onctEHJ5k7YBIJUFx0bPRdQ NIVgTZodUWKnU0W7i+zgtq4JxZQRZStdss2MpNPRjFwiqBtLSIzoeH2PkeTgTOgTbAdN yWiw3YKAzSgUnJVKCeFarkMrwaCQGVhCTIIfldywv38Mhw9CMMQRHfYmWInVjUWmV3Sl 9WCw== X-Received: by 10.68.116.169 with SMTP id jx9mr31229561pbb.94.1363591440583; Mon, 18 Mar 2013 00:24:00 -0700 (PDT) Original-Received: from debian-6.05 ([101.63.157.124]) by mx.google.com with ESMTPS id i9sm7196146paa.7.2013.03.18.00.23.56 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Mon, 18 Mar 2013 00:23:59 -0700 (PDT) In-Reply-To: <87li9vruup.fsf@mail.jurta.org> (Juri Linkov's message of "Sun, 10 Mar 2013 20:28:14 +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:72662 Archived-At: Juri (For the sake of record) Feel free to take over this bug. In light of recent developments on the mailing list, I am a bit hesitant to take these discussions any further. Jambunathan K. Juri Linkov writes: >> EXPERIMENTAL and ABANDONED PATCH > > I think your patch is useful, please don't abandon it > except its `this-command' part. As you already noted > `this-command' is very fragile and flaky. Removing everything > related to `this-command' would leave other useful parts of your patch > that adds a new defcustom `read-regexp-defaults' and especially this part: > > + (choice :tag "Function to retrieve the regexp" > + (const :tag "Use no defaults" nil) > + (radio > + (function-item find-tag-default-as-regexp) > + (function-item find-tag-default) > + (function-item :tag "Regexp history" > + (lambda nil > + "Use regexp history." > + (car regexp-history))) > + function))))) > > and a new function `read-regexp-defaults'. > > Instead of using `this-command', look for ideas to other similar features. > For example, many invocations of minibuffer functions specify their > HISTORY argument as a symbol that divides history variables into groups. > The DEFAULTS argument could use a similar grouping, i.e. when > `read-regexp' uses the symbol `regexp-history' in a call like: > > (read-regexp "Regexp to highlight" (car regexp-history) 'regexp-history) > > This could be changed to specify DEFAULTS as the symbol `read-regexp-defaults': > > (read-regexp "Regexp to highlight" 'read-regexp-defaults 'regexp-history) > > where `read-regexp-defaults' is a symbol name of the function that uses > the value of the defcustom `read-regexp-defaults' the get the default value > or returns nil. > > We could add as many additional default-providing functions > as the number of places that call `read-regexp'. But I think > it should be enough to have just two functions: > > (defun read-regexp-defaults-or-history () > (or (read-regexp-defaults) > (car regexp-history))) > > (defun read-regexp-defaults-or-tag () > (or (read-regexp-defaults) > (find-tag-default-as-regexp))) > > These two functions are necessary to keep the current status quo > where some commands traditionally provide the last history element > as the default (`highlight-regexp', `occur-read-primary-args', `how-many', > `flush-lines', `keep-lines'), and other commands provide the tag at point > (`rgrep', `query-replace', `multi-occur-in-matching-buffers'). > This is an artificial division existing solely for historical reasons. > These functions could be used e.g. in `occur-read-primary-args' as: > > (read-regexp "List lines matching regexp" 'read-regexp-defaults-or-history 'regexp-history) > > and e.g. in `grep-read-regexp': > > (read-regexp "Search for" 'read-regexp-defaults-or-tag 'regexp-history) > > This implementation will satisfy three goals: > > 1. Backward compatibility for the current traditional defaults, > 2. Allow easy customization in one place (defcustom `read-regexp-defaults'), > 3. Allow fine-tuning with function redefinitions, i.e. when > the users will ask for more specific functions they could be added as: > > (defun occur-read-regexp-defaults () > (read-regexp-defaults-or-history)) > > (defun grep-read-regexp-defaults () > (read-regexp-defaults-or-tag)) > > and can be used in `occur-read-primary-args': > > (read-regexp "List lines matching regexp" 'occur-read-regexp-defaults 'regexp-history) > > and in `grep-read-regexp': > > (read-regexp "Search for" 'grep-read-regexp-defaults 'regexp-history)