From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#41692: 26.3; Enhancement request, `query-replace': let user use text at point as default Date: Thu, 11 Jun 2020 17:34:21 -0700 (PDT) Message-ID: <355c8fb7-2113-44c4-acdd-cbbf02d3828b@default> References: <3705c67a-f3a1-4667-8c3f-67b41752f355@default> <87a71jwyiw.fsf@mail.linkov.net> <878sh2lctc.fsf@mail.linkov.net> <39e06665-8ab7-4b81-a481-9a8ccf3a15e1@default> <87a719yztv.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="122844"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41692@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 12 02:37:10 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jjXgz-000Vpu-Q6 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Jun 2020 02:37:09 +0200 Original-Received: from localhost ([::1]:43540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjXgy-0001iT-AA for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Jun 2020 20:37:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjXgr-0001i8-UL for bug-gnu-emacs@gnu.org; Thu, 11 Jun 2020 20:37:01 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55131) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jjXgr-0004l4-LP for bug-gnu-emacs@gnu.org; Thu, 11 Jun 2020 20:37:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jjXgr-0007Iu-JO for bug-gnu-emacs@gnu.org; Thu, 11 Jun 2020 20:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Jun 2020 00:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41692 X-GNU-PR-Package: emacs Original-Received: via spool by 41692-submit@debbugs.gnu.org id=B41692.159192219428021 (code B ref 41692); Fri, 12 Jun 2020 00:37:01 +0000 Original-Received: (at 41692) by debbugs.gnu.org; 12 Jun 2020 00:36:34 +0000 Original-Received: from localhost ([127.0.0.1]:38444 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjXgQ-0007Ht-3Q for submit@debbugs.gnu.org; Thu, 11 Jun 2020 20:36:34 -0400 Original-Received: from userp2120.oracle.com ([156.151.31.85]:54084) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjXgO-0007HZ-MG for 41692@debbugs.gnu.org; Thu, 11 Jun 2020 20:36:33 -0400 Original-Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05C0WuDQ099342; Fri, 12 Jun 2020 00:36:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=eSnc5Umj25AQ7QVLmTAtE8E2oFWk8vse0v48HBeMbbk=; b=eac64H7hc733LVa1Wzb9+5T57ZN8wVoXhM8dSt5V1LKnSsk66lyYzult4Ft+AiIYDxTQ LsvSoX+GUYnc7RzNSdwIwLSmqAFRDuqNy8NiAYZ9vJC6oSt5zALvUHhKXxGUGJ48ClTT oZxMy129xbXmzlPwL2z3z64sm//VRw1+YXbpPnoQM7+RGhfkyX00KoD00sY+PUVt54KE LCC0GXre8v/hzIQ4jiK834ODmGUKRwIjBvjrGYpAPFj/W3svchcyc1l5Kj2kFVtkUY4k z9GNpPlQGes62H8+Ge0rwG3/evVsWmXRlNBKOKUFrB93+VNtxo53ok0+h+hiVuDYZvqy xg== Original-Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 31g3snafk0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 12 Jun 2020 00:36:26 +0000 Original-Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05C0Y8h5145402; Fri, 12 Jun 2020 00:34:25 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 31ky6t8bj8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jun 2020 00:34:25 +0000 Original-Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 05C0YMOp002112; Fri, 12 Jun 2020 00:34:22 GMT In-Reply-To: <87a719yztv.fsf@mail.linkov.net> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.5005.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9649 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006120001 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9649 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 cotscore=-2147483648 suspectscore=0 spamscore=0 bulkscore=0 malwarescore=0 phishscore=0 mlxscore=0 mlxlogscore=999 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006120001 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:181880 Archived-At: > > `read-from-minibuffer' accepts a list of default > > values. Or maybe I don't understand what you > > mean by "more options". >=20 > Right, let's add more default values to `read-from-minibuffer' Yes, but not in a hard-coded way. What I'd suggest instead: Provide a user option, to let users choose the list of default sources (and thus also their order). The option value could be a `repeat' of a `choice' among: (1) nonempty active region, (2) secondary selection, (3) result of calling the function that's the value of a predefined option, (4) the most recent entry in the query-replace history variable - and whatever else you want to include. #1-4 are what I use in my code. Both my code and your code provide a hard-coded list. But letting a user choose the list is better. Your list includes `(find-tag-default)' and the first entry of `search-ring'. And your list doesn't include the secondary selection or the result of funcalling a function-valued variable (option). I don't have a problem with your adding more choices to the default value of the list option. I do mind that you've removed those two (second sel and function) from your list. It's especially important to include a funcallable option value. So the two changes I'd like to see to your code are: (1) add an option that lets users specify a list of sexps to evaluate to provide the list of default values, and (2) include secondary selection and (especially) a function-valued user option among the list-element `choice's. But another consideration: `query-replace-read-from' is used for several kinds of query-replacing, including for `query-replace-regexp'. For that command, `regexp-search-ring', is more appropriate than `search-ring'. The option value `choice' could thus include, not a hard-coded `search-ring', but a variable value, so `query-replace-regexp' could bind that variable to `regexp-search-ring', and `query-replace' could bind it to `search-ring'. IOW: * One option for a user-chosen list of sources of default values. Easy for a user to order the list, make it smaller, and change any of the choices that use a variable. * One function-valued option, for a user-chosen function, to be funcalled with no args to produce a default value. * One defvar whose value is used as a default value. I'd actually prefer a user option for the last one (the defvar), but I know that vanilla Emacs doesn't like to let a command bind a user option.