Subject: 27.0.50; grep-find cursor position

From: Andreas Röhler <[email-masked]>
Date: Thu, 6 Jun 2019 12:26:28 +0200

Hi,

when running M-x grep-find the cursor is in minibuffer at EOL. In
order to insert the expression, cursor is needed before braces  - see png.

The patch attached shows an example how to provide this. There might
be more cases to consider.

Thanks,
Andreas

GNU Emacs 27.0.50 (build 1, i686-pc-linux-gnu, X toolkit, Xaw3d scroll 
bars) of 2019-06-04

diff --git a/lisp/simple.el b/lisp/simple.el
index 6bc3bc5304..4bd29faabe 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3330,7 +3330,8 @@ read-shell-command
       (lambda ()
         (shell-completion-vars)
 	(set (make-local-variable 'minibuffer-default-add-function)
-	     'minibuffer-default-add-shell-commands))
+	     'minibuffer-default-add-shell-commands)
+        (when (eq (char-before) ?+) (backward-char 5)))
     (apply 'read-from-minibuffer prompt initial-contents
 	   minibuffer-local-shell-command-map
 	   nil