Skip to content

illikainen/are

Repository files navigation

Additional Regexp Engines (for Emacs)

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.

Status

These functions have been implemented:

EmacsARE
hi-lock-face-bufferare-hi-lock-face-buffer
hi-lock-unface-bufferare-hi-lock-unface-buffer
isearch-forward-regexpare-isearch-forward-regexp
isearch-backward-regexpare-isearch-backward-regexp
occurare-occur
looking-atare-looking-at
looking-at-pare-looking-at-p
re-search-backwardare-re-search-backward
re-search-forwardare-re-search-forward
string-matchare-string-match
string-match-pare-string-match-p

Installation

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

Usage

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)

About

Additional Regexp Engines for Emacs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published