bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45765: [PATCH] 28.0.50; Change default-directory before prompting in


From: Juri Linkov
Subject: bug#45765: [PATCH] 28.0.50; Change default-directory before prompting in project-compile
Date: Mon, 11 Jan 2021 20:35:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> Unlike project-shell-command, project-compile first prompts for a
> command, then binds default-directory and calls compile.  Binding
> default-directory first makes completion work from the project root,
> which is useful for completing on filenames relative to the root, on
> targets from the toplevel Makefile, etc.
>
> I see three ways to achieve this:
>
> (1) Rewrite project-compile with call-interactively, the way
> project-shell-command is written (see patch #1).

(1) has the obvious advantage of avoiding duplication of the
interactive spec of 'compile' in 'project-compile', in addition
to your use case of binding default-directory.

> I'm assuming (1) is out of the question, given 2020-06-02
> "* lisp/progmodes/project.el (project-vc-dir, project-shell): New
> commands." (2c1e5b9e77).  I'm CC'ing Juri to get his opinion though;
> project-compile is new in Emacs 28.1, so its argument list is not yet
> set in stone.

Actually, (1) is not out of the question.  Quite contrary, (1) is
the cleanest solution.  But before rewriting with call-interactively,
we need to find a way to use project-compile in the init files, i.e.
to find a replacement for such configurations:

  (define-key my-map "m" ;; mnemonics "make"
    (lambda ()
      (interactive)
      (project-compile
       ;; Use previous command from history
       ;; instead of the default from compile-command
       (compilation-read-command (car compile-history))
       ;; Don't use compilation-shell-minor-mode
       nil)))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]