summaryrefslogtreecommitdiff
path: root/lisp/progmodes/grep.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-08-25 17:02:34 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-08-25 17:03:11 +0200
commit681f2e23ae3a07decf1a459c982ee7940986cff4 (patch)
tree9c280a72f8455a15b3d0fb4262a9cc7ec97e0a64 /lisp/progmodes/grep.el
parentec4f976e8e1c072d6d6e05d77009e79da9efe885 (diff)
downloademacs-681f2e23ae3a07decf1a459c982ee7940986cff4.tar.gz
Add a new user option grep-command-position
* lisp/progmodes/grep.el (grep-command): Mention it. (grep-command-position): New user option. (grep): Use it (bug#50502).
Diffstat (limited to 'lisp/progmodes/grep.el')
-rw-r--r--lisp/progmodes/grep.el24
1 files changed, 19 insertions, 5 deletions
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 4c1f801980a..d64beaefcf7 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -126,11 +126,20 @@ include it when specifying `grep-command'.
In interactive usage, the actual value of this variable is set up
by `grep-compute-defaults'; to change the default value, use
-\\[customize] or call the function `grep-apply-setting'."
+\\[customize] or call the function `grep-apply-setting'.
+
+Also see `grep-command-position'."
:type '(choice string
(const :tag "Not Set" nil))
:set #'grep-apply-setting)
+(defcustom grep-command-position nil
+ "Where point will be put when prompting for a grep command.
+If nil, put point at the end. If not nil, this should be the
+column number where point should be set in `grep-command'."
+ :type '(choice (const :tag "At the end" nil)
+ natnum))
+
(defcustom grep-template nil
"The default command to run for \\[lgrep].
The following place holders should be present in the string:
@@ -931,10 +940,15 @@ list is empty)."
(progn
(grep-compute-defaults)
(let ((default (grep-default-command)))
- (list (read-shell-command "Run grep (like this): "
- (if current-prefix-arg default grep-command)
- 'grep-history
- (if current-prefix-arg nil default))))))
+ (list (read-shell-command
+ "Run grep (like this): "
+ (if current-prefix-arg
+ default
+ (if grep-command-position
+ (cons grep-command grep-command-position)
+ grep-command))
+ 'grep-history
+ (if current-prefix-arg nil default))))))
;; If called non-interactively, also compute the defaults if we
;; haven't already.
(when (eq grep-highlight-matches 'auto-detect)