Fork me on GitHub
#emacs
<
2018-01-16
>
ajs07:01:05

how do you all typically search for usage of a variable or any other text across all your project files? i used to just keep all my files in a flat directory so i could grep at the command line. as projects grow this is not practical, putting stuff into source directories makes more sense, but it breaks this habit

jakob07:01:02

I use this to search for text in project. https://github.com/Wilfred/ag.el . it's very quick

bozhidar07:01:02

I typically use the project search features of Projectile https://github.com/bbatsov/projectile

bozhidar07:01:24

It supports grep, ag and pt.

ajs07:01:28

i was never able to really “get” into projectile for some reason

ajs07:01:37

it seemed rather heavy but perhaps i will give it another try

bozhidar07:01:18

Heavy it want sense? It just introduces a concept of a project defined by some project marker file and lots of operations you can do with that that project.

bozhidar07:01:49

For me things like finding files in project, jumping between code and test and switching projects are invaluable.

ajs07:01:55

so if my project is already in a git repo, projectile will just automatically search within just the fils of that repo with no other setup (other than installing projectile) >?

bozhidar08:01:04

But, of course, I wrote this, so I guess I needed something like it.

bozhidar08:01:11

Yes, exactly.

ajs08:01:17

ok i’ll try it again

qqq08:01:58

+1 for projectile, it's one of my favorite libraries

qqq08:01:38

I'm using hydra, and I have an entire "hydra" dedicated to projectile related commands "browing project, finding files by name, grepping-aging through all in projectile, search/replace in project"

ajs08:01:52

trying projectile, what is difference between C-c p f and C-c p g ? what does "at point" refer to when looking for a file?

vemv08:01:01

what's a good way of asking "am I in clojure mode?" in elisp?

vemv08:01:34

I searched for code that returns a list of major modes, but it seemed quite abysmal

ajs08:01:05

i find it interesting that projectile-grep works even if projectile-mode is disabled

ajs08:01:05

am finding it quite useful despite these curiousities

benedek08:01:31

M-x describe-mode or something like that I guess

benedek08:01:11

afaik you can be in only one major mode and many minor modes

vemv08:01:18

> afaik you can be in only one major mode and many minor modes actually had forgotten about this 🙂 thanks for the hint

vemv08:01:30

major-mode is what I was looking for

ajs09:01:28

can anyone recommend a replacement for neo-tree? it's pretty good but a bit buggy, the "up a dir" feature doesn't work for me for some reason. I like having a tree of the project appear on the side with a keybinding

vemv13:01:32

I use project-explorer with some additional setup and helper functions I'd say it basically works OOTB, but getting to a fully satisfactory state got me some pain (which I haven't extracted as a lib unfortunately)

bozhidar14:01:33

@ajs I just use dired. It’s basic, but it gets the job done.

bozhidar14:01:45

> i find it interesting that projectile-grep works even if projectile-mode is disabled

bozhidar14:01:35

projectile-mode is just a container for the default keybindings, no Emacs command needs some mode to be enabled for it to be invoked.

bozhidar14:01:46

> what’s a good way of asking “am I in clojure mode?” in elisp?

bozhidar14:01:15

@vemv (derived-mode-p 'clojure-mode) is the best way to check.

bozhidar14:01:04

Using major-mode and eq won’t work for derived modes, which generally are consistent with the parent mode.

bozhidar14:01:24

> trying projectile, what is difference between C-c p f and C-c p g ? what does “at point” refer to when looking for a file?

bozhidar14:01:51

@ajs It’s the text your cursor is on. Just standard Emacs terminology.

vemv14:01:42

Thanks for the pointer! I was using a weaker check, something like (string-contains? (str major-mode) "clojure")

bozhidar14:01:19

You’re welcome.

bozhidar14:01:34

For the thing at point - the command has a better description that the manual.

bozhidar14:01:37

If point is on a filename, Projectile first tries to search for that
file in project:

- If it finds just a file, it switches to that file instantly.  This works even
if the filename is incomplete, but there's only a single file in the current project
that matches the filename at point.  For example, if there's only a single file named
\"projectile/projectile.el\" but the current filename is \"projectile/proj\" (incomplete),
`projectile-find-file-dwim' still switches to \"projectile/projectile.el\" immediately
 because this is the only filename that matches.

- If it finds a list of files, the list is displayed for selecting.  A list of
files is displayed when a filename appears more than one in the project or the
filename at point is a prefix of more than two files in a project.  For example,
if `projectile-find-file-dwim' is executed on a filepath like \"projectile/\", it lists
the content of that directory.  If it is executed on a partial filename like
 \"projectile/a\", a list of files with character 'a' in that directory is presented.

bozhidar14:01:46

(that’s for C-c p g)

tianshu15:01:19

I try to use squiggly-clojure, it works for some errors (:def-in-def, ), but not work for :wrong-arity, something I missed?