* [PATCH] Fix `grep' command to handle filenames starting with '-'.
@ 2024-11-07 9:24 Xi Lu
2024-11-07 10:40 ` Rens Oliemans
0 siblings, 1 reply; 3+ messages in thread
From: Xi Lu @ 2024-11-07 9:24 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Xi Lu
* lisp/org-mouse.el (org-mouse-context-menu): Fix `grep' command to
handle filenames starting with '-' by adjusting wildcard usage to
prevent misinterpretation as options.
---
lisp/org-mouse.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el
index 322d98682..7f85653f2 100644
--- a/lisp/org-mouse.el
+++ b/lisp/org-mouse.el
@@ -627,7 +627,7 @@ This means, between the beginning of line and the point."
["Sparse Tree" (org-occur ',region-string)]
["Find in Buffer" (occur ',region-string)]
["Grep in Current Dir"
- (grep (format "grep -rnH -e '%s' *" ',region-string))]
+ (grep (format "grep -rnH -e '%s' ./*" ',region-string))]
["Grep in Parent Dir"
(grep (format "grep -rnH -e '%s' ../*" ',region-string))]
"--"
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix `grep' command to handle filenames starting with '-'.
2024-11-07 9:24 [PATCH] Fix `grep' command to handle filenames starting with '-' Xi Lu
@ 2024-11-07 10:40 ` Rens Oliemans
2024-11-07 10:44 ` lux
0 siblings, 1 reply; 3+ messages in thread
From: Rens Oliemans @ 2024-11-07 10:40 UTC (permalink / raw)
To: Xi Lu, emacs-orgmode; +Cc: Xi Lu
Xi Lu <lx@shellcodes.org> writes:
> - (grep (format "grep -rnH -e '%s' *" ',region-string))]
> + (grep (format "grep -rnH -e '%s' ./*" ',region-string))]
This works so my comment might be a bit too bikesheddy, but another method would be to
append the argument `--` after the list of options to ensure that the rest of the
arguments aren't parsed as options; perhaps that's preferred.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix `grep' command to handle filenames starting with '-'.
2024-11-07 10:40 ` Rens Oliemans
@ 2024-11-07 10:44 ` lux
0 siblings, 0 replies; 3+ messages in thread
From: lux @ 2024-11-07 10:44 UTC (permalink / raw)
To: Rens Oliemans, emacs-orgmode
On Thu, 2024-11-07 at 11:40 +0100, Rens Oliemans wrote:
> Xi Lu <lx@shellcodes.org> writes:
>
> > - (grep (format "grep -rnH -e '%s' *" ',region-string))]
> > + (grep (format "grep -rnH -e '%s' ./*" ',region-string))]
>
> This works so my comment might be a bit too bikesheddy, but another method
> would be to
> append the argument `--` after the list of options to ensure that the rest of
> the
> arguments aren't parsed as options; perhaps that's preferred.
Yes, but I haven't tested it on other Unix-like platforms, so I'm not sure if "-
-" will work properly on all of them.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-07 10:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07 9:24 [PATCH] Fix `grep' command to handle filenames starting with '-' Xi Lu
2024-11-07 10:40 ` Rens Oliemans
2024-11-07 10:44 ` lux
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).