Project based searching within Emacs can be done using projectile.
It allows for per-project configuration of ignore files (in a <projectroot>\.projectile file), or specify subdirectories to monitor and ignore all others.
It can run grep, ack (requires ack-and-a-half.el) and ag (ag.el) on files within the defined project (either based on the ....
I ran into a similar issue with emacs, so I made Dumb Jump. I tried many of the solutions mentioned in the accepted answer, but I always ran into one or more of the following issues:
Solution only worked for a single programming language
Solution required an index (TAG) file or persistent process
I badly wanted a solution that "just worked" and didn't ...
You can jump to any definition/reference of entire project as large as Linux kernel source tree (more than 36k) in an instant. See my C/C++ guide for details. For C/C++, I suggest using GNU Global that supports C, C++, Yacc, Java, PHP4 and assembly.
The key is, if you want to have IDE features of a language, you have to install plugin of that language. Here ...
The project-wide search of only relevant files can be done using ag aka the_silver_searcher.
It ignores file patterns from your .gitignore, .hgignore, svn:ignore. You can choose for your searches to NOT use the ignore list from the version-control ignore lists by using the -U switch.
If there are files in your source repo you don't want to search, ...
I needed to manage the desktop files just like you; have a separate desktop file for each project and save buffers, emacs variables, etc independently for each.
I was able to achieve that using a package called bookmark+, available on Melpa.
bookmark+ manages different types of bookmarks, one of those is Desktop Bookmarks.
After installing the ...
Here is one piece of an approach to organizing. No doubt it can be used together with other organizing approaches.
Put libraries Bookmark+ and Dired+ in your load-path (i.e., "install" them), and load them (require) when you start Emacs.
Put your image files in one or more directories. You can take advantage of the directory structure as a first level of ...
The quick answer is to invalidate the projectile cache. When using projectile-find-file if you use C-u to send the universal argument before running the function, it will invalidate the cache before searching it. To match your example;
C-u M-x projectile-find-file
There are a number of other functions in projectile that use the prefix argument, check for ...
If your project uses Git, you only need counsel https://github.com/abo-abo/swiper
counsel-git to find file
counsel-git-grep to grep
The only dependency is git
Text grepping is faster than the silver searcher (ag)
Counsel also provides other powerful tools. For example, after running counsel-git-grep, you can press C-c C-o and C-x C-q to go into wgrep-...
Use the prefix argument, ie C-u C-c p f to quickly invalidate and find files in project. The suggestion in the comment about using projectile-cache-current-file is technically correct, but there is a hook on find-file that automatically calls this on every new file that is opened. That will be the fastest solution without invalidating the existing cache.
The primary solution for this in emacs is using TAGS files, which are created by programs such as etags or gtags. I myself use (and recommend) exuberant ctags, and etags-select.el to help you narrow down destinations when the search symbol lies in multiple destinations. The supported languages are quite numerous, see the individual tools' manuals. There is ...
you can do this with one-time git configuration. you can use it for email and so on, but also for using a different ssh key:
path = .gitconfig_work
email = …
sshCommand = ssh -i ~/.ssh/id_…_work -o 'IdentitiesOnly yes'
explanation: this makes git use another configuration,...
Actually, not quite as difficult as it seemed, added this to my init.el and it seems to work:
(defun my-proj-relative-buf-name ()
(file-relative-name buffer-file-name (projectile-project-root))))
(add-hook 'find-file-hook #'my-proj-relative-buf-name)
Edit/update, it turns out this causes problems sometimes, first time I tried M-x ...
A .dir-locals.el file would certainly do the trick!
I like to use the function (add-dir-local-variable MODE VARIABLE VALUE) rather editing .dir-locals.el manually. For those two values eval
(let ((default-directory "~/your/project/path"))
(add-dir-local-variable nil 'c-default-style "linux")
(add-dir-local-variable nil 'c-basic-offset 4))
Dunno exactly what constitutes a "project" in your context, but have a look at desktop bookmarks, with Bookmark+.
An Emacs desktop records (and subsequently restores) the kinds of thing you mention: frames, windows, buffers (open files etc.), variable values,... With only vanilla Emacs, people tend to use only a single desktop, and they use it only to save ...
If you want a list of files in a project, projectile is a currently a popular project manager in Emacs. If you use a version control system (i.e. Git), Projectile automatically recognizes it as a project and gives you a list of files with projectile-find-files. If you don't use a project manager, then add a .projectile file at project root will turn that ...
This does not speed up the file caching but it saves the manual step of having to invalidate the stale cache (which does not contain the new file).
Projectile automatically invalidates the cache if the /your/projectile/project/root/.projectile file is newer than the project cache file.
This check is done whenever you try to find any file in the project ...
For the original question (repeating my comment):
As others have pointed out, that value needs to be a string: "/usr/bin/php". You need to manually type the quotes because add-dir-local-variable has no idea what type of value is required/valid for any given variable, so string values need to be made explicit. (Despite looking like a file path, the value you'...
For C developers, I suggest ctags.
The problem of GNU Gloal is that it treats the function declaration as reference. That's awkward if you want to check the declaration of function ONLY. C++ code does not have this issue because function is always inside class/struct.
You can use https://github.com/redguardtoo/counsel-etags which provides everything you ...
I could think of two solutions as of now,
Speedbar mode - A separate frame pop-ups with the list of files/folders related to the current project. More Info (https://www.emacswiki.org/emacs/SpeedBar). Comes bundled with emacs. No extra tools needed.
GGtags mode - Generate tags for the project in the root directory, and navigate the source using M-., M-* etc. ...
Anoter useful option is the git-identity package.
From its README:
This Emacs package lets you manage local Git identities, i.e.
user.name and user.email options in .git/config, inside Emacs. It can
be useful if you satisfy all of the following conditions:
- You have multiple Git identities on the same machine(s).
- You use Emacs.
- You (almost ...
The first answer is beautiful, but it leaves out some critical details about modern versions of Emacs. I am knew to Emacs myself, so other newcomers might not be aware of this. Given your goal is to search for text WITHIN a file in a PROJECT, then you would first install Projectile using the MELPA repository.
This installs the package in .emacs.d and adds ...
Ok, I ended up programming this myself. I bind it to C-c v.
(defun java/find-or-define-variable ()
"Go to definition of variable at point. Define it if doesn't exist."
(unless (or (looking-at "[[:alnum:]_]") (looking-back "[[:alnum:]_]"))
(let (name ...