are
is a dynamic module for Emacs that implements support for
additional regular expression engines. PCRE2
is currently the only
supported engine, but it should be easy to add more engines (see
src/are_pcre2.c
for a starting point).
The idea is to reimplement commonly used Emacs functions for working
with regular expressions in a compatible manner. This should allow
users to override regexp functions through the use of advice
or
let-bindings
.
These functions have been implemented:
Emacs | ARE |
---|---|
hi-lock-face-buffer | are-hi-lock-face-buffer |
hi-lock-unface-buffer | are-hi-lock-unface-buffer |
isearch-forward-regexp | are-isearch-forward-regexp |
isearch-backward-regexp | are-isearch-backward-regexp |
occur | are-occur |
looking-at | are-looking-at |
looking-at-p | are-looking-at-p |
re-search-backward | are-re-search-backward |
re-search-forward | are-re-search-forward |
string-match | are-string-match |
string-match-p | are-string-match-p |
To install the required dependencies on a Debian-based system:
$ sudo apt-get install automake libtool uthash-dev libpcre2-dev
And to install are
in $HOME/.emacs.d/are
:
$ ./autogen
$ ./configure --prefix="$HOME/.emacs.d/are"
$ make
$ make install
Assuming that are
was installed in $HOME/.emacs.d/are
:
(add-to-list 'load-path "~/emacs.d/are/lib")
(add-to-list 'load-path "~/emacs.d/are/share/are")
(require 'are)
;; This is required to enable are-specific advice. They should never
;; interfere with the non-are versions of the relevant functions. If
;; they do, please send a bug report!
(are-mode t)
;; Example bindings.
(define-key (current-global-map) (kbd "C-c h") #'are-hi-lock-face-buffer)
(define-key (current-global-map) (kbd "C-r") #'are-isearch-backward-regexp)
(define-key (current-global-map) (kbd "C-s") #'are-isearch-forward-regexp)
(define-key (current-global-map) (kbd "M-s o") #'are-occur)