Git Product home page Git Product logo

sexp-string's Introduction

Sexp-string

Come get your sexp strings. Sexp strings going once, sexp string going twice...

Motivation

I Wanted to have a convenient way to write elisp expressions as a string. Keeping track of parenthesises doesn't make for a good user interface. Based on org-ql's method.

What it does

Convert to and from a string to a boolean elisp expression.

For example,

"tag:tag1,tag2 title:title1,title2 query1 query2 `or `(query3 `and query4 `) query5 (to be, or not to be? to not be!)"

matches the following under this predicate.

(and
 (or
  (and (tag "tag1" "tag2")
       (title "title1" "title2")
       (both "query1")
       (both "query2"))
  (and (both "query3")
       (both "query4")))
 (both "query5")
 (both "(" "to")
 (both "be" ",")
 (both "or")
 (both "not")
 (both "to")
 (both "be "?" ".")
 (both "to")
 (both "not")
 (both "be" "!" ")"))

Usage

look at how org-roam-search uses sexp-string. The key functions are

  • sexp-string--query-string-to-sexp
  • sexp-string--query-sexp-to-string
  • sexp-string--transform-query

Features

Custom pexs

Two syntaxs are currently supported. org-ql like syntax called sexp-string--custom-pexs.

  • , between args after predicates is and.
  • `or is or.
  • `and is and.
  • `(`) are brackets.
  • ! is negation.
  • E.g "tag:tag1,tag2 title:title1,title2 query1 query2 `or `(query3 `and query4 `) query5 (to be, or not to be? to not be!)"

recoll like syntax (also Notmuch (Xapian) and Xesam) called sexp-string--recoll-pexs.

  • , between args in predicates is and.
  • / between args in predicates is or.
  • OR is or.
  • AND is and.
  • () are brackets.
  • - is negation.
  • E.g "tag:tag1,tag2/tag3 OR title:title1,title2 query1 query2 OR (query3 AND query4) query5 \"(to be, or not to be? to not be!)\""

Look at sexp-string--custom-pexs to define your own.

Featured downstream packages

I know I know, these are all my packages. I don't know any one that uses this package yet.

sexp-string's People

Contributors

natask avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

alphapapa

sexp-string's Issues

(feat): support # and @ as valid search predicates

I would like to have search syntax that treats # and @ as tag predicate.
currently defined pexs expect : to follow predicates.

I would like to keep that while adding new type of predicates that apply as is.

Interface

Currently read from predicates variable and populate predicates within pex. This feature requires some predicates to be treated differently by peg. I could either add a flag to each special predicate, by use of a plist-key :bypass or :verbatim.

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.