GithubHelp home page GithubHelp logo

emacsmirror / occurx-mode Goto Github PK

View Code? Open in Web Editor NEW

This project forked from k32/occurx-mode

0.0 2.0 0.0 628 KB

Occur-like filtering of buffers with rx patterns

Home Page: https://github.com/k32/occurx-mode

License: GNU General Public License v3.0

Emacs Lisp 100.00%

occurx-mode's Introduction

occurx-mode

An Emacs plugin for filtering large log files.

Improvements over the built-in occur:

  • Patterns are specified using rx notation in a regular buffer rather than the minibuffer.
  • Patterns can be easily saved and restored.
  • It is possible to specify multiple patterns, and occurx will highlight them with different colors.
  • Searches are not limited to a single line; it is possible to use a custom delimiter.
  • It is possible to match multiple regular expressions for each entry and to negate regular expressions.

Teaser

./screenshot.png

How to

  1. Open a log file
  2. Run M-x occurx-mode
  3. Type o to open a new buffer and enter search patterns there
  4. Type C-c C-c to run the patterns

Search patterns

Pattern buffer is parsed as an ELisp file, producing a list of sexps. Examples:

Literal strings

Strings are treated literally rather than as regexps:

"String"
"[a-b]"

The above example will search for entries containing text String or [a-b] and highlight them with different colors.

Regular expressions

((or "foo" "bar")) ; Search for regexp "foo|bar" and choose a random face to highlight the pattern
(:face hi-yellow (seq "foo" "bar")) ; Highlight pattern with a specific face

Multiple matches

("foo" (or "bar" "baz")) ; Entry must contain both "foo" and "bar|baz" in any order

Negation

:not keyword allows to inverse patterns:

(:not "foo" (or "bar" "baz")) ; Entry must contain "bar|baz", but not "foo"

Sub-matches

It’s possible to highlight only a specific sub-match of the regexp using :sub N construction:

(:sub 1 (seq "foo" (group "bar"))) ; Entry must contain "foobar", but only "bar" is highlighted

Entry delimiter

By default entries are delimited by \n, but it’s possible to override the delimiter by adding the following expression to the search buffer:

(delimiter RX-expression)

RX amendments

Behavior of (and X Y Z) construct is changed so it inserts “.*” between sub-expressions. Use (seq X Y Z) if you need old behavior.

occurx-mode's People

Contributors

k32 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.