Subject: 30.0.50; compile-command not honored in shell buffers
From: Matthias Meulien <[email-masked]>
To: [email-masked]
Date: Sat, 02 Sep 2023 15:39:20 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

I customize the default compile command using directory local
variables. For example, with a '.dir-locals' containing the following:

;;; Directory Local Variables            -*- no-byte-compile: t -*-
;;; For more information see (info "(emacs) Directory Variables")

((nil . ((compilation-search-path . (nil "builddir"))
	 (compile-command . "meson setup builddir . --cross-file crossfile_arm.ini ; pushd builddir && meson compile ; popd")
	 (compilation-environment . ("TERM=ansi"))
	 (ispell-local-dictionary . "en")
	 (project-vc-merge-submodules . nil)))
 (c++-mode . ((c-basic-offset . 2)
	      (indent-tabs-mode . nil))))

When I enter the *vc-dir* buffer for the corresponding Git local
repository, and I press 'C-x p c' ('project-compile' command) then the
default compile command has the value specified in the previous
'.dir-locals.el'.

Same with 'meson.build', 'README.md', '*.cc', '*.h', etc. files.

But when 'project-compile' is called from a shell buffer after I pressed
'C-x p s' then the default compile command is 'make -k'.  This is
strange and looks like a bug to my eyes.

(I successfully reproduced from 'emacs -Q').

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.37, cairo version 1.16.0) of 2023-08-30 built on carbon
Repository revision: 297ccd967f24e37bc51c057da43c862291a55ddd
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

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

Important settings:
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Shell

Minor modes in effect:
  hexl-follow-ascii: t
  goto-address-mode: t
  highlight-changes-visible-mode: t
  breadcrumb-mode: t
  minions-mode: t
  global-company-mode: t
  company-mode: t
  desktop-save-mode: t
  server-mode: t
  pixel-scroll-precision-mode: t
  save-place-mode: t
  shell-dirtrack-mode: t
  comint-fontify-input-mode: t
  electric-pair-mode: t
  icomplete-mode: t
  global-so-long-mode: t
  global-auto-revert-mode: t
  auto-insert-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-layout-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  window-divider-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/matthias/.config/emacs/elpa/dictionary-20201001.1727/dictionary hides /usr/local/share/emacs/30.0.50/lisp/net/dictionary

Features:
(shadow sort emacsbug pcmpl-gnu shortdoc comp comp-cstr cl-print
help-fns ediff-ptch ediff ediff-merg ediff-mult ediff-wind ediff-diff
ediff-help ediff-init ediff-util ffap conf-mode restclient ox-odt
ox-latex ox-icalendar org-agenda ox-html table ox-ascii ox-publish ox
oc-basic org-element org-persist org-id avl-tree ol-eww ol-rmail ol-mhe
ol-irc ol-info ol-gnus nnselect ol-docview doc-view jka-compr ol-bibtex
bibtex ol-bbdb ol-w3m ol-doi org-link-doi kmacro quail rect align
pcmpl-git eudc eudc-vars mail-extr gnus-msg gnus-art mm-uu mml2015
mm-view mml-smime smime dig gnus-sum tabify cus-start ert-x compat-macs
loaddefs-gen radix-tree tar-mode arc-mode archive-mode mm-archive
package-vc lisp-mnt gnutls network-stream url-cache url-http url-auth
url-gw nsm finder-inf mule-util novice dabbrev pcmpl-unix pulse log-edit
add-log grep misearch multi-isearch hexl make-mode generic flyspell rst
rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc rng-uri
rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns
nxml-mode nxml-outln nxml-rap sgml-mode facemenu nxml-util nxml-enc
xmltok meson-mode whitespace tramp-cache time-stamp goto-addr vc-hg
vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs log-view pcvs-util
image-dired image-dired-tags image-dired-external image-dired-util
image-mode exif man eww url-queue shr pixel-fill kinsoku url-file svg
dom mm-url hl-line yasnippet-snippets yasnippet smerge-mode diff
hideshow js sh-script smie executable vc-dir vc flymake-cc cwarn
cap-words superword subword dired-aux display-line-numbers hilit-chg
c-ts-mode c-ts-common eglot external-completion jsonrpc flymake-proc
flymake ert ewoc debug backtrace warnings compile breadcrumb imenu
modus-operandi-tinted-theme modus-themes company-oddmuse
company-keywords company-etags etags fileloop generator xref
company-gtags company-dabbrev-code company-dabbrev company-files
company-clang company-capf company-cmake company-semantic
company-template company-bbdb ob-python python project treesit cl-extra
minions compat company pcase carbon-custom cus-edit cus-load gnus-demon
nntp gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud
nnimap nnmail mail-source utf7 gnus-spec gnus-win nnoo gnus-int
gnus-range message sendmail yank-media puny rfc822 mml mml-sec epa
derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus
nnheader gnus-util mail-utils range mm-util mail-prsvr wid-edit
gnus-dired dired-x dired dired-loaddefs org-capture org-refile org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint
org-pcomplete org-list org-footnote org-faces org-entities ob-emacs-lisp
ob-core ob-eval org-cycle org-table ol org-fold org-fold-core org-keys
oc org-loaddefs find-func cal-menu calendar cal-loaddefs org-compat
org-version org-macs dictionary link connection advice markdown-mode
color thingatpt noutline outline icons skeleton find-file vc-git
diff-mode easy-mmode vc-dispatcher ispell desktop frameset server
bookmark text-property-search pp pixel-scroll cua-base saveplace
tramp-sh tramp rx trampver tramp-integration files-x tramp-message
help-mode tramp-compat xdg shell pcomplete comint ansi-osc ring
parse-time iso8601 time-date format-spec ansi-color tramp-loaddefs
elec-pair icomplete so-long autorevert filenotify autoinsert cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs generic-x face-remap breadcrumb-autoloads caml-autoloads
company-autoloads csv-mode-autoloads debbugs-autoloads
dockerfile-mode-autoloads flymake-easy-autoloads git-link-autoloads
go-mode-autoloads mallard-mode-autoloads markdown-mode-autoloads
minions-autoloads compat-autoloads modus-themes-autoloads
proof-general-autoloads proof-site proof-autoloads
restclient-jq-autoloads jq-mode-autoloads restclient-autoloads
rfc-mode-autoloads mmm-mode-autoloads terraform-mode-autoloads info
dash-autoloads hcl-mode-autoloads typescript-mode-autoloads
yaml-autoloads yaml-mode-autoloads yasnippet-snippets-autoloads package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache
json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs
cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process emacs)

Memory information:
((conses 16 1355808 206303) (symbols 48 49861 9)
 (strings 32 213796 6304) (string-bytes 1 6773049) (vectors 16 108792)
 (vector-slots 8 2137202 94939) (floats 8 751 3676)
 (intervals 56 122749 17311) (buffers 992 208))