From 3e9cada75129e899add86d00e0aa3be050d04937 Mon Sep 17 00:00:00 2001 From: fengqi Date: Thu, 9 Sep 2021 15:28:02 +0800 Subject: [PATCH] Separate option --multiline-dotall and --multiline Using option `--multiline` doesn't necessarily mean the user also wants `--multiline-dotall`. The user may be certain about the number of new lines involved. For example, with this code snippet: ```c if (level == 2U) { parent_irq = irq_parent_level_2(irq); table_idx = parent_offset + irq_from_level_2(irq); } #ifdef CONFIG_3RD_LEVEL_INTERRUPTS else if (level == 3U) { parent_irq = irq_parent_level_3(irq); table_idx = parent_offset + irq_from_level_3(irq); } ``` If I want to search all the #ifdef followed by a else statement, I can use regex '#ifdef.*\n.*else'. If `--multiline-dotall` is used, this regex will match more lines than I expected. --- rg-menu.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rg-menu.el b/rg-menu.el index c6b3295..d84feba 100644 --- a/rg-menu.el +++ b/rg-menu.el @@ -126,7 +126,8 @@ FUNC is an rerun function invoked from an `rg-mode' buffer." (6 "-a" "Search binary files" "--text") (4 "-z" "Search zipped files" "--search-zip") (4 "-v" "Invert match" "--invert-match") - (4 "-U" "Multi line" "--multiline-dotall --multiline") + (4 "-U" "Multi line" "--multiline") + (4 "-." "Dot all" "--multiline-dotall") (3 "-w" "Search words" "--word-regexp") (5 "-x" "Search lines" "--line-regexp") (5 "-P" "Use PCRE2 regexps" "--pcre2")