Juri Linkov <juri@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 70996) by debbugs.gnu.org; 28 May 2024 16:34:16 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 28 12:34:16 2024 Received: from localhost ([127.0.0.1]:46859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sBzmC-0006Lw-62 for submit <at> debbugs.gnu.org; Tue, 28 May 2024 12:34:16 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:49647) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1sBzmA-0006Lf-Su; Tue, 28 May 2024 12:34:15 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 46A8420007; Tue, 28 May 2024 16:33:35 +0000 (UTC) From: Juri Linkov <juri@HIDDEN> To: 70996 <at> debbugs.gnu.org Subject: Re: bug#70996: project-find-file defaults In-Reply-To: <867cft2ggx.fsf@HIDDEN> (Juri Linkov's message of "Fri, 17 May 2024 09:36:22 +0300") Organization: LINKOV.NET References: <867cft2ggx.fsf@HIDDEN> Date: Tue, 28 May 2024 19:32:20 +0300 Message-ID: <8634q1c2y2.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@HIDDEN X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 70996 Cc: Dmitry Gutov <dmitry@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) close 70996 30.0.50 thanks > (thing-at-point 'filename) in project-find-file is a very useful feature > that often helps to use a string under point as a partial file name > to match a project file name as substring. So it's like 'M-.' > that navigates by file names instead of identifiers. > > But the problem is that in this case it drops the current file name > as the default value that is also useful in many cases. > > Fortunately, the minibuffer supports a list of default values, > like in the following patch: With no objections this is pushed to master.
bug-gnu-emacs@HIDDEN
:bug#70996
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 17 May 2024 06:52:16 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 17 02:52:16 2024 Received: from localhost ([127.0.0.1]:53481 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s7rRw-0002PM-2P for submit <at> debbugs.gnu.org; Fri, 17 May 2024 02:52:16 -0400 Received: from lists.gnu.org ([209.51.188.17]:52676) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1s7rRt-0002PG-Gg for submit <at> debbugs.gnu.org; Fri, 17 May 2024 02:52:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1s7rRq-0006i6-GI for bug-gnu-emacs@HIDDEN; Fri, 17 May 2024 02:52:10 -0400 Received: from relay8-d.mail.gandi.net ([2001:4b98:dc4:8::228]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1s7rRo-0001ty-6g for bug-gnu-emacs@HIDDEN; Fri, 17 May 2024 02:52:10 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id B4B3B1BF219 for <bug-gnu-emacs@HIDDEN>; Fri, 17 May 2024 06:52:01 +0000 (UTC) From: Juri Linkov <juri@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: project-find-file defaults Organization: LINKOV.NET X-Debbugs-Cc: Dmitry Gutov <dmitry@HIDDEN> Date: Fri, 17 May 2024 09:36:22 +0300 Message-ID: <867cft2ggx.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-GND-Sasl: juri@HIDDEN Received-SPF: pass client-ip=2001:4b98:dc4:8::228; envelope-from=juri@HIDDEN; helo=relay8-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain (thing-at-point 'filename) in project-find-file is a very useful feature that often helps to use a string under point as a partial file name to match a project file name as substring. So it's like 'M-.' that navigates by file names instead of identifiers. But the problem is that in this case it drops the current file name as the default value that is also useful in many cases. Fortunately, the minibuffer supports a list of default values, like in the following patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=project-find-file-at-point.patch diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index a95d1267dd2..5e6516b3b64 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1077,8 +1130,9 @@ project-find-file (dirs (list root)) (project-files-relative-names t)) (project-find-file-in - (or (thing-at-point 'filename) - (and buffer-file-name (project--find-default-from buffer-file-name pr))) + (delq nil (list (and buffer-file-name (project--find-default-from + buffer-file-name pr)) + (thing-at-point 'filename))) dirs pr include-all))) ;;;###autoload @@ -1100,8 +1154,9 @@ project-or-external-find-file (project-external-roots pr))) (project-file-history-behavior t)) (project-find-file-in - (or (thing-at-point 'filename) - (and buffer-file-name (project--find-default-from buffer-file-name pr))) + (delq nil (list (and buffer-file-name (project--find-default-from + buffer-file-name pr)) + (thing-at-point 'filename))) dirs pr include-all))) (defcustom project-read-file-name-function #'project--read-file-cpd-relative @@ -1163,11 +1218,14 @@ project--read-file-cpd-relative (setq all-files (delete common-parent-directory all-files)) t)) - (mb-default (if (and common-parent-directory - mb-default - (file-name-absolute-p mb-default)) - (file-relative-name mb-default common-parent-directory) - mb-default)) + (mb-default (mapcar (lambda (mb-default) + (if (and common-parent-directory + mb-default + (file-name-absolute-p mb-default)) + (file-relative-name + mb-default common-parent-directory) + mb-default)) + (ensure-list mb-default))) (substrings (mapcar (lambda (s) (substring s cpd-length)) all-files)) (_ (when included-cpd (setq substrings (cons "./" substrings)))) --=-=-=--
Juri Linkov <juri@HIDDEN>
:dmitry@HIDDEN, bug-gnu-emacs@HIDDEN
.
Full text available.dmitry@HIDDEN, bug-gnu-emacs@HIDDEN
:bug#70996
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.