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: Kévin Le Gouguec
Subject: bug#45765: [PATCH] 28.0.50; Change default-directory before prompting in project-compile
Date: Sun, 10 Jan 2021 13:57:07 +0100

Hello,

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).

(2) Set COMMAND to nil in the interactive spec, then prompt for it after
binding default-directory (see patch #2).

(3) Let-binding default-directory once in the interactive spec, and
again before calling compile.


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.

I've taken a stab at (2), but my patch changes the semantics of COMMAND
for an edge case: for now calling (project-compile nil) from Lisp causes
(compile nil) to be called (which errors out); with my patch,
(project-compile nil) yields a prompt.

This can be solved using called-interactively-p (or using an optional
INTERACTIVE argument); I just don't know if it's worth the hassle?

I haven't given much thought to (3), so I haven't yet figured out how to
avoid prompting twice for the project (on the rare occasions where
prompting is needed).


Thanks for your time.


Attachment: 0001-Change-default-directory-before-prompting-in-project-1.patch
Description: Text Data

Attachment: 0001-Change-default-directory-before-prompting-in-project-2.patch
Description: Text Data


In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo 
version 1.16.0)
 of 2021-01-04 built on my-little-tumbleweed
Repository revision: 2c847902522ae74c9b25b2a3fa60565e0187fd0a
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12010000
System Description: openSUSE Tumbleweed

Configured using:
 'configure --with-xwidgets --with-cairo'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS JSON
PDUMPER LCMS2

Important settings:
  value of $LC_CTYPE: en_US.UTF-8
  value of $LC_TIME: en_GB.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix

reply via email to

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