1

I am seeking advice for how to get tab completion in the minibar with a custom set of completion candidates that are either subdirectories or build targets from Makefiles.

For context, I'm using the Emacs compile command to build code, with the instructions for the build inside Makefiles. There may be multiple Makefiles in the project and each one might contain multiple targets which I want to build. I would like something like an augmented read-file-name that either lets me move through the directory tree to find Makefiles in some subdirectory or that completes with the list of make targets if the current directory contains a Makefile.

To be concrete, say the layout of my project is as follows.

.
├── dir
│   ├── README
│   ├── some_config_file
│   └── subdir
│       ├── do_it.sh
│       └── Makefile
└── Makefile

Lets says that the top-level Makefile has possible targets "target1" and "target2", and dir/subdir/Makefile has "target3".

How can I write somethign like read-file-name which would offer possible completions:

  1. dir or target1 or target2 when in the top-level directory
  2. subdir when in dir
  3. target3 when in subdir

I am only guessing that read-file-name is the right starting point, but if that guess is wrong, please feel free to suggest alternatives too.

  • 1
    See helm-make on MELPA. You should add a link to "target3" to the top-level Makefile; that's the typical approach. – abo-abo Sep 6 '17 at 18:15
  • Completion in the minibar sounds like fun. Better not try to work the next morning though. ;-) – Drew Nov 27 '18 at 23:22

Your Answer

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

Browse other questions tagged or ask your own question.