Subject: make mode should recognize ::= as a macro assignment

From: Robert Lange <[email-masked]>
Date: Thu, 29 Oct 2020 16:34:09 -0400

Using the following simple Makefile as an example:

Begin file Makefile
---
ELC_FILES ::= foo.elc

all: $(ELC_FILES)

.el.elc:
	$(EMACS) -batch -Q -L . -f batch-byte-compile "$<"
---
End file Makefile

I've tested this on Emacs 26.1 on Debian, as well as a self-compiled 27.1. When I use the GNU immediate assignment operator `:=` the macro name ELC_FILES is correctly shown in font-lock in the macro color. But if I use the POSIX standard `::=` (well, forthcoming POSIX standard, but  GNU emacs has supported it since v4.0) ELC_FILES is incorrectly shown in the target color.

Looking in lisp/progmodes/make-mode.el, the const makefile-macroassign-regex is pretty gnarly, but I *think* it should match a `::=`, so I'm assuming it's getting preempted by something else, probably the const makefile-dependency-regex. Unfortunately, that regexp is a bit more than I can interpret, and I don't dare change it because I'll almost certainly break some other obscure but legal cases.

I'd appreciate any insights anyone has on this.

--Rob Lange

---
In GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2019-09-22, modified by Debian built on x86-grnet-01
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description:	Debian GNU/Linux 10 (buster)

Recent messages:
Loading /etc/emacs/site-start.d/50texlive-lang-english.el (source)...done
Loading delsel...done
Loading diff-hl...done
Loading hl-line...done
Loading paren...done
Loading xt-mouse...done
Starting new Ispell process aspell with default dictionary...
Starting Emacs daemon.
When done with this frame, type C-x 5 0
Making completion list...

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --enable-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --build
 x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd
 --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/26.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -fdebug-prefix-map=/build/emacs-StqULU/emacs-26.1+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 THREADS LIBSYSTEMD LCMS2

Important settings:
  value of $LC_COLLATE: C.UTF-8
  value of $LC_MONETARY: en_US.utf8
  value of $LC_NUMERIC: en_US.utf8
  value of $LC_TIME: en_DK.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  column-enforce-mode: t
  company-mode: t
  flyspell-mode: t
  show-paren-mode: t
  global-hl-line-mode: t
  global-diff-hl-mode: t
  diff-auto-refine-mode: t
  delete-selection-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
~/.emacs.d/lisp/26.1/sh-script hides /usr/share/emacs/26.1/lisp/progmodes/sh-script
/usr/share/emacs/site-lisp/latex-cjk-thai/thai-word hides /usr/share/emacs/26.1/lisp/language/thai-word
/usr/share/emacs/site-lisp/auctex/tex-jp hides /usr/share/auctex/tex-jp
/usr/share/emacs/site-lisp/auctex/tex-fold hides /usr/share/auctex/tex-fold
/usr/share/emacs/site-lisp/auctex/tex-style hides /usr/share/auctex/tex-style
/usr/share/emacs/site-lisp/auctex/latex hides /usr/share/auctex/latex
/usr/share/emacs/site-lisp/auctex/plain-tex hides /usr/share/auctex/plain-tex
/usr/share/emacs/site-lisp/auctex/bib-cite hides /usr/share/auctex/bib-cite
/usr/share/emacs/site-lisp/auctex/multi-prompt hides /usr/share/auctex/multi-prompt
/usr/share/emacs/site-lisp/auctex/texmathp hides /usr/share/auctex/texmathp
/usr/share/emacs/site-lisp/auctex/toolbar-x hides /usr/share/auctex/toolbar-x
/usr/share/emacs/site-lisp/auctex/tex-ispell hides /usr/share/auctex/tex-ispell
/usr/share/emacs/site-lisp/auctex/context-nl hides /usr/share/auctex/context-nl
/usr/share/emacs/site-lisp/auctex/preview hides /usr/share/auctex/preview
/usr/share/emacs/site-lisp/auctex/tex-font hides /usr/share/auctex/tex-font
/usr/share/emacs/site-lisp/auctex/tex hides /usr/share/auctex/tex
/usr/share/emacs/site-lisp/auctex/context hides /usr/share/auctex/context
/usr/share/emacs/site-lisp/auctex/context-en hides /usr/share/auctex/context-en
/usr/share/emacs/site-lisp/auctex/tex-buf hides /usr/share/auctex/tex-buf
/usr/share/emacs/site-lisp/auctex/prv-emacs hides /usr/share/auctex/prv-emacs
/usr/share/emacs/site-lisp/auctex/font-latex hides /usr/share/auctex/font-latex
/usr/share/emacs/site-lisp/auctex/tex-mik hides /usr/share/auctex/tex-mik
/usr/share/emacs/site-lisp/auctex/tex-bar hides /usr/share/auctex/tex-bar
/usr/share/emacs/site-lisp/auctex/tex-info hides /usr/share/auctex/tex-info

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec epa derived epg gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils server column-enforce-mode company-oddmuse
company-keywords company-etags etags xref project ring company-gtags
company-dabbrev-code company-dabbrev company-files company-clang
company-capf company-cmake company-semantic company-template
company-bbdb company-c-headers company edmacro kmacro pcase flyspell
ispell elec-pair time-date xt-mouse paren hl-line diff-hl vc-dir ewoc vc
vc-dispatcher diff-mode easy-mmode delsel cus-start cus-load dim
printing ps-print ps-print-loaddefs ps-def lpr finder-inf rx info
package easymenu epg-config url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache url-vars seq
byte-opt bytecomp byte-compile cconv cl gv tls gnutls cl-loaddefs cl-lib
preview-latex tex-site auto-loads mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic 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 charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 297298 12039)
 (symbols 48 31862 1)
 (miscs 40 74 128)
 (strings 32 97361 2676)
 (string-bytes 1 2485635)
 (vectors 16 28006)
 (vector-slots 8 675528 13560)
 (floats 8 309 45)
 (intervals 56 308 0)
 (buffers 992 13))