سؤال

How can you find a file in a project (defined as everything under a single directory) using Icicles in Emacs? The feature I am looking for is similar to that offerred by the Projectile package.

The documentation mentions that this is possible, but says nothing on how to actually do it.

The reason I want to do this with Icicles instead of Projectile is that I want to use Icicles completion features and not Projectile's ido-like interface.

هل كانت مفيدة؟

المحلول

There are several ways to find a file among your project files. And the doc page you cite is the best place to start. Which ways you choose can depend on how you define a project as a collection of files.

If, as you say, you define your project files as all of those in and under a single directory (i.e., recursively), then these are some ways to do what you want:

  • Use command icicle-locate or icicle-locate-file for the project directory -- see Find Files Anywhere, Without Knowing Where . You can cache the set of project file names for better performance -- see Persistent Completions.

    Note that these commands, like all Icicles file-visiting commands, also let you search file contents -- match file name or contents or both. See Match File Names and File Content Too.

  • As @Aaron suggested, you can open Dired for your project main directory, and then use one of the Icicles commands for the contents of the marked files:

    • M-x M-s m (command icicles-search-dired-marked-recursive) -- it uses Icicles search.

    • M-+ C-F (command icicle-visit-marked-file-of-content-recursive) -- it visits marked files whose content matches a search pattern. (Again, see Match File Names and File Content Too.

  • Create bookmarks to Dired listings of your project directory. They can have different sets of files marked or omitted. If you use Bookmak+ then markings, omissions, and inserted subdirectories are all recorded as part of the bookmark.

  • Use Dired+ for even more possibilities -- synergy among Dired, Icicles and Bookmark+.

    In particular, all of the things mentioned here, and more, are available from the Dired+ menus. (That will help you learn their keys.)

    In particular, see submenu Marked Here and Below of menu-bar menu Multiple (which deals with marked files). It is the menu for acting on files anywhere below the current directory (no need to insert the subdirs etc.).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top