From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#34621: Patch Update Date: Tue, 5 Mar 2019 10:44:10 -0800 (PST) Message-ID: <40839b67-bce7-4a01-89f1-c14643b18b32@default> References: <08e7108149ce2374fd0c9b7fc3e6ae38@reckondigital.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="86850"; mail-complaints-to="usenet@blaine.gmane.org" To: Christopher Thorne , 34621@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 05 19:46:46 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h1F5R-000MS3-B5 for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Mar 2019 19:46:45 +0100 Original-Received: from localhost ([127.0.0.1]:47741 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1F5Q-0000Ui-CP for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Mar 2019 13:46:44 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1F3y-0007s1-0O for bug-gnu-emacs@gnu.org; Tue, 05 Mar 2019 13:45:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1F3u-0000GW-It for bug-gnu-emacs@gnu.org; Tue, 05 Mar 2019 13:45:12 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48130) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1F3q-0008PL-7F for bug-gnu-emacs@gnu.org; Tue, 05 Mar 2019 13:45:08 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h1F3n-0004ZA-Ot for bug-gnu-emacs@gnu.org; Tue, 05 Mar 2019 13:45:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Mar 2019 18:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34621 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 34621-submit@debbugs.gnu.org id=B34621.155181146117485 (code B ref 34621); Tue, 05 Mar 2019 18:45:02 +0000 Original-Received: (at 34621) by debbugs.gnu.org; 5 Mar 2019 18:44:21 +0000 Original-Received: from localhost ([127.0.0.1]:33441 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h1F37-0004Xx-4c for submit@debbugs.gnu.org; Tue, 05 Mar 2019 13:44:21 -0500 Original-Received: from userp2130.oracle.com ([156.151.31.86]:45440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h1F34-0004Xg-Au for 34621@debbugs.gnu.org; Tue, 05 Mar 2019 13:44:19 -0500 Original-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x25IXcOP071579; Tue, 5 Mar 2019 18:44:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=4lDeQx16TCdudzYPjs7iakY6TEudtB894hAHxerwPPs=; b=ej6PuqTE4QgTaPNWY3PRqwjJ4+m9ABbb/6uE29WrWNmfu3MHq/pxEc6E027IvKXLcPLQ 8lu2nQ2JwChQB1+muEVeyQC1Tm38W3LVRyqe6sMezdnzpuyDD2rWl9SpX3595G/jl781 kUoqYUKqhgxnGpgqg0123JhEiHkr614aqlg4u+V9p7XDkyZxoNP7VldfKsDz+ELvVhvM 0LyNWUFcQR0u2hYPjlPeC3KCibhJzbTgM0uB7IJe4V8L2dTzkYAKOvuXMKutJtk9LTpB cZw++xXW2zLG6xnxOyA43DFVK5NOExt2iD7XvRh8KsjJF7kjaU/oc9yAKTeq5rY3UPN1 aw== Original-Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2qyh8u78ph-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Mar 2019 18:44:12 +0000 Original-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x25IiBCS008119 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Mar 2019 18:44:12 GMT Original-Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x25IiAN6013215; Tue, 5 Mar 2019 18:44:11 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4810.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9186 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903050122 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.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" Xref: news.gmane.org gmane.emacs.bugs:156064 Archived-At: > > It doesn't sound to me like this has anything, per se, > > to do with Dired. It has to do with how the default is > > determined, and that's apparently now being picked up > > from the buffer name. >=20 > Hmm, I think you're right that this isn't just isolated to dired. For > example, I can start a shell-mode buffer, rename it to shell.txt and > rgrep will now suggest "*.txt" as the default extension even though my > buffer is unrelated to .txt files. >=20 > An alternative I considered is only showing extension suggestions for > buffers that are associated with a file (i.e. buffer-file-name is a > non-empty string). Can you think of any cases where this would fall > down? I don't think it's a question of falling down. It's not obvious what a reasonable or smart default filename pattern is in most cases. Just because your current buffer is visiting a file does not at all imply that you want to search files with the same extension. I think you need to (for yourself) specify just what relation (if any) you want between the current buffer and the default filename pattern. If it's a question of improving `rgrep` then the determination of the default needs to be such that it's useful generally and typically, and perhaps user configurable. As an example, but for the search pattern only (not the filename pattern(s)), in `grep+.el' there is user option `grepp-default-regexp-fn` and a default function of the same name, as follows. (If the option value is not a function then the default function is used.) https://www.emacswiki.org/emacs/grep%2b.el I mention this only as an example of how you can provide some flexibility and user control. For filename pattern(s) obviously the ways of picking a default would be different. ------------8<-------------- grepp-default-regexp-fn is a variable defined in `grep+.el'. Its value is non-nil-symbol-name-nearest-point Documentation: Function of 0 args called to provide default search regexp to \\[grep]. Some reasonable choices are defined in `thingatpt+.el': `word-nearest-point', `non-nil-symbol-name-nearest-point', `region-or-non-nil-symbol-name-nearest-point', `sexp-nearest-point'. This is ignored if Transient Mark mode is on and the region is active and non-empty. In that case, the quoted (") region text is used as the default regexp. If `grepp-default-regexp-fn' is nil and no prefix arg is given to `grep', then no defaulting is done. Otherwise, if the value is not a function, then function `grepp-default-regexp-fn' does the defaulting. You can customize this variable. ------------8<-------------- (defun grepp-default-regexp-fn () "*Function of 0 args called to provide default search regexp to \\[grep]. This is used only if both of the following are true: - Transient Mark mode is off or the region is inactive or empty. - The value of option `grepp-default-regexp-fn' is `grepp-default-regexp-fn'. When this is used, the default regexp is provided by calling the first of these that references a defined function: - variable `grepp-default-regexp-fn' - variable `find-tag-default-function' - the `find-tag-default-function' property of the `major-mode' - function `non-nil-symbol-name-nearest-point', if bound - function `grep-tag-default'" (cond ((functionp grepp-default-regexp-fn) grepp-default-regexp-fn) (find-tag-default-function) ((get major-mode 'find-tag-default-function)) ((fboundp 'non-nil-symbol-name-nearest-point) 'non-nil-symbol-name-= nearest-point) (t 'find-tag-default)))