mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-06 03:40:56 -08:00
New user option 'grep-use-headings'
* lisp/progmodes/grep.el (grep-heading-regexp): New user option. (grep-heading): New face (bug#59888). (grep--heading-format, grep--heading-state, grep--heading-filter): Filter function for grep processes and supporting variables. (grep-use-headings): New user option. (grep-mode): Use the above, if applicable.
This commit is contained in:
parent
b699c38028
commit
93f557af0e
3 changed files with 89 additions and 0 deletions
|
|
@ -66,4 +66,18 @@
|
|||
(cl-letf (((symbol-function 'w32-shell-dos-semantics) #'ignore))
|
||||
(grep-tests--check-rgrep-abbreviation))))
|
||||
|
||||
(ert-deftest grep-tests--grep-heading-regexp-without-null ()
|
||||
(dolist (sep '(?: ?- ?=))
|
||||
(let ((string (format "filename%c123%ctext" sep sep)))
|
||||
(should (string-match grep-heading-regexp string))
|
||||
(should (equal (match-string 1 string) "filename"))
|
||||
(should (equal (match-string 2 string) (format "filename%c" sep))))))
|
||||
|
||||
(ert-deftest grep-tests--grep-heading-regexp-with-null ()
|
||||
(dolist (sep '(?: ?- ?=))
|
||||
(let ((string (format "funny:0:filename%c123%ctext" 0 sep)))
|
||||
(should (string-match grep-heading-regexp string))
|
||||
(should (equal (match-string 1 string) "funny:0:filename"))
|
||||
(should (equal (match-string 2 string) "funny:0:filename\0")))))
|
||||
|
||||
;;; grep-tests.el ends here
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue