Subject: bug#22551: 24.5; M-x grep: can't add option after default option list

From: Benoit Coste <[email-masked]>
Date: Thu, 04 Feb 2016 17:21:10 +0100

Hi and thank you for supporting Emacs. It is cool that people do that
and I should get involved at some point.

It is not really a bug but an issue that has room for improvement.
When I type M-x grep, this is what I get.

Run grep (like this): grep --color -nH -e

If if try to add an option after the '-e', let's say '-R', Emacs thinks
the option is the pattern I am looking for instead of considering it as
an option.

In other words:
'grep --color -nH -e' with as following:
      ' -R foo bar' does not work. It fails to find the '-R' pattern.
      ' foo bar -R' works

If this has already been mentioned, then sorry for the inconvenience.
Cheers,
Benoit

In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu)
 of 2015-09-17 on lgw01-52, modified by Debian
System Description:	Ubuntu 15.10

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 --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --with-x=no --without-gconf --without-gsettings 'CFLAGS=-g -O2
 -fstack-protector-strong -Wformat -Werror=format-security -Wall'
 CPPFLAGS=-D_FORTIFY_SOURCE=2 'LDFLAGS=-Wl,-Bsymbolic-functions
 -Wl,-z,relro''

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

Major mode: HTML

Minor modes in effect:
  shell-dirtrack-mode: t
  desktop-save-mode: t
  ido-everywhere: t
  which-function-mode: t
  tooltip-mode: t
  electric-indent-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

Recent messages:
Quit [2 times]
Mark saved where search started [2 times]
Quit
Grep exited abnormally with code 2
Please answer yes or no.
Quit
Grep exited abnormally with code 2
Grep finished (matches found)
Quit
Making completion list...

Load-path shadows:
/usr/share/emacs/24.5/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils help-mode shell pcomplete grep compile tool-bar
misearch multi-isearch term disp-table ehelp add-log xterm conf-mode
vc-git js advice help-fns byte-opt bytecomp byte-compile cl-extra cconv
thingatpt cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs image nroff-mode sh-script smie executable
python easymenu json comint ring ansi-color regexp-opt sgml-mode edmacro
kmacro tango-dark-theme desktop frameset cl-loaddefs cl-lib ido
time-date which-func imenu leuven-theme-autoloads package epg-config
tooltip electric uniquify ediff-hook vc-hooks lisp-float-type
tabulated-list newcomment lisp-mode prog-mode register page menu-bar
rfn-eshadow timer select 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 multi-tty emacs)

Memory information:
((conses 16 250847 11724)
 (symbols 48 26846 0)
 (miscs 40 190 566)
 (strings 32 47419 6211)
 (string-bytes 1 1349254)
 (vectors 16 19510)
 (vector-slots 8 492318 3973)
 (floats 8 85 1388)
 (intervals 56 14050 0)
 (buffers 960 45)
 (heap 1024 29513 816))