Subject: bug#24000: 24.5; makefile-bsdmake-mode has incomplete keyword syntax

From: "Greg A. Woods" <[email-masked]>
Date: Fri, 15 Jul 2016 15:28:43 -0700

Although it is not well described in the manuals for all variants of BSD
Make, all regular users of any and all variants of BSD Make assume that
all include, conditional, and loop statements (i.e. what's described in
the "INCLUDE STATEMENTS, CONDITIONALS AND FOR LOOPS" section of the
manual page) may contain a combination of spaces and/or tabs btween the
mandatory leading '.' on the line and the keyword.  (This is documented
properly in OpenBSD.)

This optional white space is not properly represented in the setup of
font-lock keywords for makefile-bsdmake-mode.

Indeed it would appear that the keyword syntax allows space before the
'.' in some situations, but this is actually not allowed by any BSD Make
I'm aware of.  A makefile line which is parsed as a BSD Make statement
always begins with a leading '.', then optional white space, then the
statement keyword.

I've tried to fix it in order to provide both a work-around and a proper
patch, but the setup of font-lock-keywords in make-mode.el is extremely
convoluted and overly complex, so for now I've been unable to find a
clean and simple way to fix the problem such that it won't mess up other
variants of the mode.

In GNU Emacs 24.5.1 (x86_64--netbsd, X toolkit, Xaw3d scroll bars)
 of 2015-05-01 on more
Windowing system distributor `The X.Org Foundation', version 11.0.11704000
Configured using:
 `configure '--srcdir=/var/package-obj/editors/emacs/work/emacs-24.5'
 '--without-dbus' '--without-rsvg' '--with-x' '--with-xpm' '--with-jpeg'
 '--with-tiff' '--with-gif' '--with-png'
 '--x-includes=/usr/X11R6/include' '--x-libraries=/usr/X11R6/lib'
 '--with-x-toolkit=athena' '--enable-static' '--without-libiconv-prefix'
 '--without-libintl-prefix' '--disable-dependency-tracking'
 '--prefix=/usr/pkg' '--build=x86_64--netbsd' '--host=x86_64--netbsd'
 '--sysconfdir=/etc' '--localstatedir=/var'
 '--infodir=/usr/pkg/share/info' '--mandir=/usr/pkg/share/man'
 'build_alias=x86_64--netbsd' 'host_alias=x86_64--netbsd' 'CC=cc'
 'CFLAGS=-O2 -g -pipe -I/usr/pkg/include -I/usr/include
 -I/usr/X11R6/include -I/usr/pkg/include/freetype2' 'LDFLAGS=-static
 -L/usr/pkg/lib -L/usr/lib -L/usr/X11R6/lib -Wl,-R/usr/pkg/lib
 -Wl,-R/usr/X11R6/lib' 'LIBS=' 'CPPFLAGS=-I/usr/pkg/include
 -I/usr/include -I/usr/X11R6/include -I/usr/pkg/include/freetype2''

Important settings:
  value of $LANG: POSIX
  locale-coding-system: nil

Major mode: BSDmakefile

Minor modes in effect:
  auto-image-file-mode: t
  display-time-mode: t
  timeclock-mode-line-display: t
  normal-erase-is-backspace-mode: t
  show-paren-mode: t
  diff-auto-refine-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  tooltip-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
  blink-cursor-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

Recent messages:
Saving...done
 [2 times]
Mark set [7 times]
 [3 times]
I-search backward: org
Mark saved where search started [2 times]
Mark set
 [2 times]
Saving...done
 [3 times]
Mark set

Saving...done
 [5 times]
Mark set [2 times]

Load-path shadows:
/Users/gaw/lib/elisp/git hides /usr/local/share/emacs/site-lisp/git/git

Features:
(shadow sort mail-extr emacsbug pp gitignore-mode org-journal org-crypt
org-rmail org-mhe org-irc org-info org-gnus org-docview doc-view
image-mode org-bibtex bibtex org-bbdb org-w3m org-element avl-tree org
org-macro org-footnote org-pcomplete org-list org-faces org-entities
foldout noutline outline org-version ob-emacs-lisp ob ob-tangle ob-ref
ob-lob ob-table ob-exp org-src ob-keys ob-comint ob-core ob-eval
org-compat org-macs org-loaddefs vc-bzr vc-svn vc-rcs gitconfig-mode
conf-mode rx eieio-opt speedbar sb-image ezimage dframe magit-ediff
ediff-merg ediff-wind ediff-diff ediff-mult ediff-help ediff-init
ediff-util ediff novice vc-annotate vc-sccs apropos etags flyspell
mule-util log-view tutorial make-mode pcmpl-unix debug misearch
multi-isearch vc-git cc-langs linum image-file time sendmail timeclock
solar cal-dst appt diary-lib diary-loaddefs cal-menu calendar
cal-loaddefs ispell hippie-exp warnings view cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs pcvs
vc-cvs pcvs-parse pcvs-info pcvs-defs ewoc find-func browse-url paren
sh-script smie executable magit-blame magit-stash magit-bisect
magit-remote magit-commit magit-sequence magit magit-apply dired
magit-wip magit-log magit-diff smerge-mode diff-mode magit-core
magit-autorevert autorevert filenotify magit-process magit-popup
magit-mode help-mode magit-git crm magit-section magit-utils git-commit
log-edit message rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils
gmm-utils mailheader pcvs-util add-log with-editor async-bytecomp async
tramp-sh tramp tramp-compat auth-source eieio byte-opt bytecomp
byte-compile cl-extra cconv eieio-core gnus-util mm-util mail-prsvr
password-cache tramp-loaddefs trampver shell pcomplete format-spec
server dash grep compile comint ansi-color ring smart-tabs-mode
easy-mmode cl-macs gv advice help-fns jka-compr memory-usage-autoloads
edmacro kmacro cl-loaddefs cl-lib info easymenu package epg-config vc
vc-dispatcher time-date tooltip electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer 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 make-network-process dynamic-setting
font-render-setting x-toolkit x multi-tty emacs)

Memory information:
((conses 16 1322060 498123)
 (symbols 48 60525 0)
 (miscs 40 14312 19970)
 (strings 32 124948 58169)
 (string-bytes 1 9760525)
 (vectors 16 50673)
 (vector-slots 8 1676984 201609)
 (floats 8 875 3094)
 (intervals 56 252344 62878)
 (buffers 960 138))