[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How should a clone of the `grep` program highlight matches for Emacs?
From: |
Raffaele Ricciardi |
Subject: |
How should a clone of the `grep` program highlight matches for Emacs? |
Date: |
Sun, 21 Jun 2015 16:32:57 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
I am writing an Emacs script as a replacement for the `grep` program
while executing the `rgrep` command. Now, I can't make my Emacs script
highlight the matches in a way that Emacs understands.
After having read the Emacs Lisp file that defines the `rgrep` command
-- which I am using for my tests -- I guess that the script should
surround matches with Select Graphic Rendition sequences; and it is
doing so, like this:
(princ "\x1b[31m") ; 31 means "red", as hard-coded in `grep.el`
(princ (match-string-no-properties 0))
(princ "\x1b[0m"))
These sequences do cause a terminal to highlight the matches, but not
Emacs (of course, Emacs does highlight matches from `grep`).
What should the script do instead? Thank you.
- How should a clone of the `grep` program highlight matches for Emacs?,
Raffaele Ricciardi <=