Subject: 24.4; GNUmakefile mode: C-c C-c does not comment lines in recipes correctly

From: Alain Kalker <[email-masked]>
Date: Wed, 28 Jan 2015 15:55:38 +0100

In a buffer editing a Makefile, marking a line in a recipe then doing
C-c C-c should put a "#" at the beginning of the line (before the
<tab>).  Instead, it puts "# " before the command, which doesn't make a
valid Makefile comment, i.e. it gets sent to the shell. In particular,
expansions like $(definedvar) get executed, which is usually not what is
wanted.

I think that Emacs should check whether the lines in the selected region
start with <tab>, in which case the "#" should go before the <tab>(s).

In GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.7)
 of 2015-01-17 on bisson
Windowing system distributor `The X.Org Foundation', version 11.0.11603000
System Description:	Arch Linux

Configured using:
 `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 --param=ssp-buffer-size=4' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'

Important settings:
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: GNUmakefile

Minor modes in effect:
  delete-selection-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  show-paren-mode: t
  google-this-mode: t
  global-whitespace-mode: t
  global-flycheck-mode: t
  flycheck-mode: t
  global-company-mode: t
  company-mode: t
  cua-mode: t
  server-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 input:
C-x C-f M a k e f i l e <return> f o o : <return> <tab> 
e c h o SPC b a r <return> <tab> e c h o SPC b a z 
<return> <up> <S-down> C-c C-c C-c M-x r e p o r t 
- e m a <tab> <return>

Recent messages:
[yas] Loading for `prog-mode', just-in-time: (lambda nil (yas--load-directory-1 (quote /home/miki/.emacs.d/elpa/yasnippet-20141223.303/snippets/prog-mode) (quote prog-mode)))!
[yas] Loading compiled snippets from /home/miki/.emacs.d/elpa/yasnippet-20141223.303/snippets/prog-mode
Loading /home/miki/.emacs.d/elpa/yasnippet-20141223.303/snippets/prog-mode/.yas-setup...done
For information about GNU Emacs and the GNU system, type C-h C-a.
(New file)
[yas] Loading for `makefile-gmake-mode', just-in-time: (lambda nil (yas--load-directory-1 (quote /home/miki/.emacs.d/elpa/yasnippet-20141223.303/snippets/makefile-gmake-mode) (quote makefile-gmake-mode)))!
[yas] Loading compiled snippets from /home/miki/.emacs.d/elpa/yasnippet-20141223.303/snippets/makefile-gmake-mode
[yas] Loading for `makefile-mode', just-in-time: (lambda nil (yas--load-directory-1 (quote /home/miki/.emacs.d/elpa/yasnippet-20141223.303/snippets/makefile-mode) (quote makefile-mode)))!
[yas] Loading compiled snippets from /home/miki/.emacs.d/elpa/yasnippet-20141223.303/snippets/makefile-mode
Mark set

Load-path shadows:
/usr/share/emacs/site-lisp/SuperCollider/tree-widget hides /usr/share/emacs/24.4/lisp/tree-widget

Features:
(shadow sort mail-extr emacsbug message idna cl-macs format-spec rfc822
mml mml-sec mm-decode mm-bodies mm-encode mailabbrev gmm-utils
mailheader sendmail vc-git make-mode hideshow eldoc elisp-slime-nav
hl-sexp thingatpt .emacs saveplace imenu company-files company-oddmuse
company-keywords company-etags etags ring company-gtags
company-dabbrev-code company-dabbrev company-capf company-cmake
company-ropemacs company-xcode company-clang company-semantic
company-eclim company-template company-css company-nxml company-bbdb
company-irony irony-completion irony-snippet company-tern s
ucs-normalize dash-functional tern url-http tls url-auth mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums url-gw json tsdh-dark-theme delsel
yasnippet cl gv paren google-this easy-mmode url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
url-parse auth-source eieio byte-opt bytecomp byte-compile cconv
eieio-core password-cache url-vars mailcap gnus gnus-ems nnheader
gnus-util mail-utils mm-util help-fns mail-prsvr wid-edit whitespace
flycheck-irony pcase irony-diagnostics irony flycheck find-func
help-mode rx subr-x dash company cua-base cus-start cus-load ix grapnel
pkg-info-autoloads epl-autoloads queue-autoloads info easymenu
slime-autoloads sly-autoloads package epg-config server edmacro kmacro
cl-loaddefs cl-lib 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 dbusbind
gfilenotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 281588 13670)
 (symbols 48 28284 0)
 (miscs 40 91 134)
 (strings 32 42741 7231)
 (string-bytes 1 1207705)
 (vectors 16 41774)
 (vector-slots 8 775934 9330)
 (floats 8 427 420)
 (intervals 56 270 74)
 (buffers 960 14)
 (heap 1024 43631 1614))