1

Is there an Emacs package that can help organize buffers into projects? I commonly work on many projects, but I only have one Emacs instance open (with hundreds of buffers). It would be nice if I could easily organize the buffers into projects (using for example a tag associated with each buffer; the tag name could for example be the name of the project that the buffer belongs to).

I could think of some tasks that could be performed by this package:

  • Search through buffers of a given project
  • List buffers of a given project
  • Delete buffers of a given project,

and so on..

  • 4
    what about projectile? – Nsukami _ Feb 16 '15 at 9:05
  • 2
    In addition to projectile, check out ibuffer and, to use both, ibuffer-projectile. – Dan Feb 16 '15 at 14:46
  • @Nsukami_ Do you want to make this an answer with brief introduction of how to use projectile to do stuff that Håkon wants? As Dan said, ibuffer-projectile is super-awesome! – Kaushal Modi Feb 16 '15 at 19:29
  • @kaushalmaudi sure, give me five seconds ;) – Nsukami _ Feb 16 '15 at 20:25
4

First thing is to make sure projectile is installed, you can install projectile using the MELPA repository. Then, you should ensure that projectile-mode is activated: M-x projectile-mode.

Projectile identify the root project using the .git directory or if you're not using git, you can put a .projectile file in the project root.

Search through buffers of a given project

C-c p s s, to runs ag on the project. Requires the presence of ag.el

C-c p o, to run multi-occur on all project buffers currently open

List buffers of a given project

C-c p b, to display a list of all project buffers currently open.

Delete buffers of a given project

C-c p k, to kill all project buffers

Courtesy of Projectile github page ;)


Also,

As stated by Dan in the comments, you can also use ibuffer mode and ibuffer-projectile, to group buffers by projectile project.

Hope this will help.

  • 2
    FWIW you can use ibuffer's grouping facilities without projectile. You can configure your groups manually (probably filtering by file path), and you can easily save/load/update your group configuration(s) whenever necessary. – phils Feb 16 '15 at 22:39
  • @phils never really played with ibuffer. Should I edit my answer, to add the precision? – Nsukami _ Feb 17 '15 at 0:46
  • I think your answer is fine as it is -- it's specifically about Projectile, so it makes sense to suggest using ibuffer-projectile as well. Give M-x ibuffer a try, though; it's nice. – phils Feb 17 '15 at 1:51
  • @phils Ok, I'll give M-x ibuffer a try, thank you for the advice. – Nsukami _ Feb 17 '15 at 2:32
2

If you use Bookmark+ then you can tag bookmarks. And you can bookmark non-file buffers as well as file and directory (Dired) buffers.

So yes, you can use this feature to tag projects and project components of various sorts.

Tags are arbitrary strings, by default (including spaces, newline chars, etc). But a tag can also be an association of such a name with a Lisp value. In other words, a tag can act just like an object attribute or property: it can be a name/value pair.

Different projects or project states (e.g. workflow, releases) can have different tags for the same sets of files.

There are other project-related Bookmark+ features, besides tags, and which complement the use of tags. Predefined bookmark types that are particularly useful for project management include Dired, Dired tree, bookmark-list, bookmark-file, and desktop bookmarks. Use these, for example, to switch among projects. And you can easily define your own type-specific bookmark "jump" command for any set of bookmarks (e.g., the files that make up a project).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.