all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* project.el project-find-files and symlinks
@ 2021-05-21 11:57 Juris Bune
  2021-05-21 15:22 ` Drew Adams
  2021-05-24  1:01 ` Dmitry Gutov
  0 siblings, 2 replies; 5+ messages in thread
From: Juris Bune @ 2021-05-21 11:57 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Hello!

I've been using emacs for few months now and slowly building up my skill and knowledge of ecosystem. It has been great so far.

Recently I started using project.el (v0.6) and found one annoying thing - project-find-files does not include file symlinks. I understand that it is due to fact that under the hood it uses GNU find and current implementation of project--files-in-directory has a somewhat hard-coded values for find flags.

To solve my case I would add "-L" option appropriately to have find utility list also symlinks. Unfortunately this is not configurable without (as I understand) changing package.el. Are there any other options?

Also, would it be somehow possible to make project.el use fd <https://github.com/sharkdp/fd> instead of find?

Thanks!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: project.el project-find-files and symlinks
  2021-05-21 11:57 project.el project-find-files and symlinks Juris Bune
@ 2021-05-21 15:22 ` Drew Adams
  2021-05-24  1:01 ` Dmitry Gutov
  1 sibling, 0 replies; 5+ messages in thread
From: Drew Adams @ 2021-05-21 15:22 UTC (permalink / raw)
  To: Juris Bune, help-gnu-emacs@gnu.org

> Recently I started using project.el (v0.6) and found one annoying thing
> - project-find-files does not include file symlinks. I understand that
> it is due to fact that under the hood it uses GNU find and current
> implementation of project--files-in-directory has a somewhat hard-coded
> values for find flags.
> 
> To solve my case I would add "-L" option appropriately to have find
> utility list also symlinks. Unfortunately this is not configurable
> without (as I understand) changing package.el. Are there any other
> options?
> 
> Also, would it be somehow possible to make project.el use fd
> <https://urldefense.com/v3/__https://github.com/sharkdp/fd__;!!GqivPVa7
> Brio!K83q5UJOTwJ5MP68rcv73oyDC69pq2aWUK3oKALL8jY7HudFiVJ8beAMjANrvJk_$>
> instead of find?

You might want to file an enhancement request:

M-x report-emacs-bug




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: project.el project-find-files and symlinks
  2021-05-21 11:57 project.el project-find-files and symlinks Juris Bune
  2021-05-21 15:22 ` Drew Adams
@ 2021-05-24  1:01 ` Dmitry Gutov
  2021-06-12 18:10   ` Juris
  1 sibling, 1 reply; 5+ messages in thread
From: Dmitry Gutov @ 2021-05-24  1:01 UTC (permalink / raw)
  To: Juris Bune, help-gnu-emacs@gnu.org

Hi!

On 21.05.2021 14:57, Juris Bune wrote:
> Hello!
> 
> I've been using emacs for few months now and slowly building up my skill and knowledge of ecosystem. It has been great so far.
> 
> Recently I started using project.el (v0.6) and found one annoying thing - project-find-files does not include file symlinks. I understand that it is due to fact that under the hood it uses GNU find and current implementation of project--files-in-directory has a somewhat hard-coded values for find flags.

> To solve my case I would add "-L" option appropriately to have find utility list also symlinks. Unfortunately this is not configurable without (as I understand) changing package.el. Are there any other options?

You can try out a patch like

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index eab60756c8..616c6f8d32 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -297,7 +297,7 @@ project--files-in-directory
           ;; expanded and not left for the shell command
           ;; to interpret.
           (localdir (file-name-unquote (file-local-name 
(expand-file-name dir))))
-         (command (format "%s -H %s %s -type f %s -print0"
+         (command (format "%s -H -L %s %s -type f %s -print0"
                            find-program
                            (shell-quote-argument
                             (directory-file-name localdir)) ; Bug#48471

and see if you like the effect. I'm not sure how to make it better 
configurable, though. The current literal that's used looks like

   "%s -H -L %s %s -type f %s -print0"

...and that's not something a random user will know how to change 
safely. It's also very find-specific.

I suppose you'd also want the project-vc backend (e.g. in Git repos) to 
follow symlinks as well?

I also wonder whether there have been any discussions in the past about 
adding -L to grep-find-template.

> Also, would it be somehow possible to make project.el use fd <https://github.com/sharkdp/fd> instead of find?

People have asked about this before. Please read:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44210#26

...and email to the bug address if you'd like to contribute to that 
discussion.



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: project.el project-find-files and symlinks
  2021-05-24  1:01 ` Dmitry Gutov
@ 2021-06-12 18:10   ` Juris
  2021-06-17 13:10     ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Juris @ 2021-06-12 18:10 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Hi!

On 24.05.21 04:01, Dmitry Gutov wrote:
> Hi!
> 
> On 21.05.2021 14:57, Juris Bune wrote:
>> Hello!
>>
>> I've been using emacs for few months now and slowly building up my 
>> skill and knowledge of ecosystem. It has been great so far.
>>
>> Recently I started using project.el (v0.6) and found one annoying 
>> thing - project-find-files does not include file symlinks. I 
>> understand that it is due to fact that under the hood it uses GNU find 
>> and current implementation of project--files-in-directory has a 
>> somewhat hard-coded values for find flags.
> 
>> To solve my case I would add "-L" option appropriately to have find 
>> utility list also symlinks. Unfortunately this is not configurable 
>> without (as I understand) changing package.el. Are there any other 
>> options?
> 
> You can try out a patch like
> 
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index eab60756c8..616c6f8d32 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -297,7 +297,7 @@ project--files-in-directory
>            ;; expanded and not left for the shell command
>            ;; to interpret.
>            (localdir (file-name-unquote (file-local-name 
> (expand-file-name dir))))
> -         (command (format "%s -H %s %s -type f %s -print0"
> +         (command (format "%s -H -L %s %s -type f %s -print0"
>                             find-program
>                             (shell-quote-argument
>                              (directory-file-name localdir)) ; Bug#48471
> 
> and see if you like the effect. I'm not sure how to make it better 
> configurable, though. The current literal that's used looks like
> 
>    "%s -H -L %s %s -type f %s -print0"
> 
> ...and that's not something a random user will know how to change 
> safely. It's also very find-specific.

Thanks for the tip Dmitry, I did try this and it does solve my 
complaint. The downside being that I have to manage a patches project.el 
and track upstream changes manually. Surely some easy configuration 
would be a welcome change but, I also understand your stance.

> 
> I suppose you'd also want the project-vc backend (e.g. in Git repos) to 
> follow symlinks as well?

Hmmm, that would be yes.

> 
> I also wonder whether there have been any discussions in the past about 
> adding -L to grep-find-template.
> 
>> Also, would it be somehow possible to make project.el use fd 
>> <https://github.com/sharkdp/fd> instead of find?
> 
> People have asked about this before. Please read:
> 
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44210#26
> 
> ...and email to the bug address if you'd like to contribute to that 
> discussion.

Thanks again!
Juris



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: project.el project-find-files and symlinks
  2021-06-12 18:10   ` Juris
@ 2021-06-17 13:10     ` Dmitry Gutov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Gutov @ 2021-06-17 13:10 UTC (permalink / raw)
  To: Juris, help-gnu-emacs@gnu.org

On 12.06.2021 21:10, Juris wrote:
> Thanks for the tip Dmitry, I did try this and it does solve my 
> complaint. The downside being that I have to manage a patches project.el 
> and track upstream changes manually. Surely some easy configuration 
> would be a welcome change but, I also understand your stance.
> 
>>
>> I suppose you'd also want the project-vc backend (e.g. in Git repos) 
>> to follow symlinks as well?
> 
> Hmmm, that would be yes.

If we wanted to add an option, could you 'M-x report-emacs-bug' and 
describe the feature in more detail?

That is, steps to create an example directory, current and desired 
behaviors.

Bonus points for describing how the 'vc' project backend currently 
behaves with such a dir.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-17 13:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-21 11:57 project.el project-find-files and symlinks Juris Bune
2021-05-21 15:22 ` Drew Adams
2021-05-24  1:01 ` Dmitry Gutov
2021-06-12 18:10   ` Juris
2021-06-17 13:10     ` Dmitry Gutov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.