From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: [Patch] Add project.el command to replace symbol at point throughout project Date: Sun, 16 Jan 2022 05:02:35 +0200 Message-ID: References: <83zgo2770l.fsf@gnu.org> <83zgo15dhp.fsf@gnu.org> <83czkw3uvl.fsf@gnu.org> <170a1c89-7767-0930-f726-f7b2551876b2@yandex.ru> <44f72f97-d1d8-0b4c-73a0-7f077fb1ef26@yandex.ru> <0617E8BF-CC43-4D82-8648-064252F644FD@gmail.com> <86pmos3no7.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9782"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 Cc: Eli Zaretskii , emacs-devel@gnu.org To: Juri Linkov , Jon Eskin Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 16 04:07:00 2022 Return-path: Envelope-to: ged-emacs-devel@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 1n8vsh-0002OH-Qe for ged-emacs-devel@m.gmane-mx.org; Sun, 16 Jan 2022 04:06:59 +0100 Original-Received: from localhost ([::1]:46880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n8vsg-00033k-9I for ged-emacs-devel@m.gmane-mx.org; Sat, 15 Jan 2022 22:06:58 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:53740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n8vq2-0001JY-RC for emacs-devel@gnu.org; Sat, 15 Jan 2022 22:04:14 -0500 Original-Received: from [2a00:1450:4864:20::331] (port=56107 helo=mail-wm1-x331.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n8vq0-0003LQ-My; Sat, 15 Jan 2022 22:04:14 -0500 Original-Received: by mail-wm1-x331.google.com with SMTP id c66so13443935wma.5; Sat, 15 Jan 2022 19:04:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=uYyfnHXmaw4EqoHcmw2/9gJmweOWDg9roev33fMoV4Y=; b=NSO/ZKlu98mpgGK236PoWc/wpGjg6pjwdrFOrgGB4ja/8sxe3HzRwDYR8ZyfPn8hbq reYCIsfzJRtUUR7qzIBbKBABkpokmPYE+OpW+h2U7MwS4j5CxU6PKj8TD4ioCN4Wbe3t 1i93+T4kvdojia6gvjy9k1BmJ6OsqVrXKnDnhZo2aPWxctL9Cij5S/Lfqh07WYQIjAb2 nYpKYqJOG6yuv2mKOH75UV18fG82prBpXIkkDO7d3HGu8oaFJ0e2ecYffPFs56YOCZx1 M5DwCnl+NiGXywN5AyBIGCupGKvPqvpf4/VwdoaEYARg87e517KKKhCnERGuCFPZIFi5 9MDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=uYyfnHXmaw4EqoHcmw2/9gJmweOWDg9roev33fMoV4Y=; b=Rusjf0xNXOP+Zu4P4i8/ZNbAvJa0ufPEwWiDKmO5YtEK0wGDMj8GzE+uREDAUe8ojr uR+XZcYtQ2JkHu4rz4p5cuonNUoz3zwv7apXsuV0Ygd/UV5Cm0/ENkBWYWeSG1xizG11 CtgkaqFMO5d070a+qSJlwIW3k8/7EdV7e9dj5xutfshpYmTJDxjc1N37uXGH3n/Yi9L8 CsED//Mek+tgMClLRhd8IK11i7ABzz2MDP/Iz0Nvz3PTvxdaBO3VM8xdjUTL5ClIUt07 bMpNmNFYAdaIWvKlCuqJm83QwIy9p8MV+iQqnKhy0heS2ccbui+fcuW6nfuyAM1EK+08 W0kA== X-Gm-Message-State: AOAM532ZfaVtuIU/CcEfvu0wQQGb0AIVjiLqEh/NPWdvYQPGItRDs0HN jgbVDEsEU2KG/G9wtzYqTA/0YSJWGnc= X-Google-Smtp-Source: ABdhPJxIQtR4Zse4q1m55aZD/z5hHj1oBywfIQiKPauI2TNUsuxVq3kJ7UCsVA/t/9YBO2yRSKckQA== X-Received: by 2002:a1c:f414:: with SMTP id z20mr14474939wma.17.1642302250529; Sat, 15 Jan 2022 19:04:10 -0800 (PST) Original-Received: from [10.112.15.98] ([185.209.196.168]) by smtp.googlemail.com with ESMTPSA id b14sm2239857wri.62.2022.01.15.19.04.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 15 Jan 2022 19:04:09 -0800 (PST) In-Reply-To: <86pmos3no7.fsf@mail.linkov.net> Content-Language: en-US X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::331 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=raaahh@gmail.com; helo=mail-wm1-x331.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, NICE_REPLY_A=-0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:284797 Archived-At: On 15.01.2022 20:30, Juri Linkov wrote: >> When I first let-bound `read-regexp-defaults-function` around the call to >> `query-replace-read-args`, it didn't work- it looks like `read-regexp` >> needs to be passed a symbol for its `DEFAULTS` parameter or it ignores >> `read-regexp-default-function`. I passed in the symbol at point to >> `DEFAULTS` which works- if I understand correctly the value of any I pass >> in doesn't end up making a difference as long as it's a symbol. I wasn't >> sure what the reason was for that behavior, but I didn't want to mess with >> stuff I didn't understand. > > This is needed to handle `read-regexp` in `occur-read-primary-args` > that uses the symbol `regexp-history-last` by default. occur? read-regexp is called from query-replace-read-from. Binding read-regexp-defaults-function doesn't seem to work because its use is for some reason predicated on (and defaults (symbolp defaults)) evaluating to non-nil. And 'read-regexp' is called with nil second argument. > Before finishing this implementation, please answer one question. > `query-replace-read-from` uses two minibuffer-reading functions: > > (if regexp-flag > (read-regexp prompt sym-at-point 'minibuffer-history) > (read-from-minibuffer > prompt nil nil nil nil > (query-replace-read-from-suggestions) t)) > > Do you think the same default with the symbol at point > should be used for the non-regexp case with read-from-minibuffer as well? > If yes, then we need a different solution that works for both cases. It doesn't have to be the same. project-query-replace-regexp could bind read-regexp-defaults-function, and xref-find-references-and-replace could bind something else. But that variable still needs to be created.