jcollard / elm-mode

Elm mode for emacs
GNU General Public License v3.0
373 stars 67 forks source link

Proposal: exclude node_modules when generating tags #150

Open lonnelars opened 5 years ago

lonnelars commented 5 years ago

When generating tags for my elm project, I would like to exclude the node_modules directory in addition to the elm-stuff directory. My problem is that tags are generated for the elm-test package, and I only want tags for my own elm files.

I have solved it temporarily by changing elm-tags.el:

@@ -57,13 +57,11 @@
     (let* ((default-directory (elm--find-dependency-file-path))
            (find-command "find . -type f -name \"*.elm\" -print")
            (exclude-command (if elm-tags-exclude-elm-stuff
-                                (concat find-command " | egrep -v elm-stuff")
+                                (concat find-command " | egrep -v \"(elm-stuff|node_modules)\"")
                               find-command))

If you are interested in a PR, I would be happy to submit one.

purcell commented 5 years ago

I'd think this situation is pretty common, and in general having the tags file cover related JS too might be helpful. But I understand where you're coming from here, and the desire to exclude elm-test's .elm files. Perhaps it would make more sense to ignore node_modules/elm-test specifically?

lonnelars commented 5 years ago

Sound good to me.

I'm thinking we could reuse the customize variable elm-tags-exclude-elm-stuff to also exclude node_modules/elm-test. What are your thoughts on that?

purcell commented 5 years ago

Yep, sounds reasonable. In Elm 0.19 there shouldn't be any elm source inside elm-stuff anyway, so sooner or later that variable will go away, I expect.

akoppela commented 4 years ago

What do you think folks about changing elm-tag-exclude-elm-stuff to just elm-tag-exclude which can be a list of strings (folders) to exclude. So people can explicitly set what they'd like to exclude. If it's necessary to keep elm-tags-exclude-elm-stuff then it can add/remove "elm-stuff" to elm-tags-exclude list. I'm not sure how is versioning done here and if it make sense to keep old things or just replace them with new ones.

purcell commented 4 years ago

What do you think folks about changing elm-tag-exclude-elm-stuff to just elm-tag-exclude which can be a list of strings (folders) to exclude.

Sure, that would make sense. Ideally we'd do a bit more work to properly build up a find command which handles those efficiently: it would be better to pass correct arguments to find than to apply grep -v to its output.

akoppela commented 2 years ago

Sure, that would make sense. Ideally we'd do a bit more work to properly build up a find command which handles those efficiently: it would be better to pass correct arguments to find than to apply grep -v to its output.

That's actually correct