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+.
Library Bookmark+ manages different types of bookmarks, one of those is Desktop Bookmarks.
After installing the package,
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-...
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 ...
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,...
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 ...
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 ...
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))
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 ...
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 ...
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 ...
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 ...
What I would want is a function or a package that could display all opened projectile projects with ivy or helm and let me choose a candidate. When the candidate would be selected, the last buffer opened in that project would be opened. It would be basically a counsel-switch-buffer but with projects. If possible the last visited project would display first.
I ran into this, too, and published the project-find-functions hook I use on https://michael.stapelberg.ch/posts/2021-04-02-emacs-project-override/:
;; Returns the parent directory containing a .project.el file, if any,
;; to override the standard project.el detection logic when needed.
(defun zkj-project-override (dir)
(let ((override (locate-dominating-...
Note: This is a very complicated solution. See How to use xref-find-references on Elisp files without "No references found for" errors for when I came to my senses and simplified things.
Problems and fixes
I found multiple things that I did that tripped me up:
I had an ~/ID file that is generated using ID Utils. xref, or
something beneath it, ...
xref provides UI for code navigation. The actual functionalities are provided by the backend. In you case, the backend is etags.
If you open TAGS file, its format is very simple. It has only the information of tag definition. So you can not find reference of tag.
So you got two solutions,
Install lsp-mode and some language server, hope they ...
Use https://github.com/technomancy/find-file-in-project (ffip).
What ~ means does not matter. ffip will try to find file in project root using the file name under cursor.
This custom function finds the file as described by looking for the src directory of the file currently being visited and assumes that the directory one above is the cwd.
As a consequence it only works if used while visiting a file somewhere inside the src directory else it will not find the cwd.
(defun my-find-file-at-point-with-tilde ()
"Find the file ...
Emacs packages will automatically find the project root,
company-gtags (for code completion) from https://github.com/company-mode/company-mode
counsel-git-grep (for grepping) and counsel-git (for finding file) from https://github.com/abo-abo/swiper
IMO, workspace is an outdated idea. Everything should just work out of box without setup.
BTW, unlike ...
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. ...
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 ...