Git Product home page Git Product logo

dagit / autoproc Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 98 KB

Autoproc is a utility/language for email filtering. Autoproc makes it easy to define filtering rules. The rules define a Haskell program, that when executed generates a valid Procmail recipes file. This file can then be used with Procmail to sort and filter your email before you see it.

License: Other

Haskell 100.00%

autoproc's Introduction

= Autoproc =

Autoproc is a utility/language for email filtering.  Autoproc makes it
easy to define filtering rules.  The rules define a Haskell program,
that when executed generates a valid Procmail recipes file.  This file
can then be used with Procmail to sort and filter your email before
you see it.

You will need to have GHC or Hugs, Procmail and formail installed.

== Installation ==

To get a copy of Autoproc, use

  darcs get http://code.haskell.org/autoproc

If you don't have darcs do not despair, currently Autoproc is about 5
files and can be easily downloaded by pointing your web browser at the
address just given.

You can also visit Hackage, where you should be able to find a tarball of autoproc (or eventually you could install Autoproc through cabal-install).

== Customizing Autoproc ==

Autoproc runs on the XMonad model. If you aren't familiar with XMonad, the idea is that the package is constructed such that it provides a library, and then it compiles a thin executable using that library.

This is fine if the baked in configuration exactly suits your needs, but how do you have a system-wide XMonad which you can configure in a full Haskell style without some sort of Emacs-style interpreter? Well, the thin executable is tasked with looking for a xmonad.hs in a fixed location; if it exists, it gets compiled and the *new* binary gets run. And your personal xmonad.hs can do anything it wants - as all of XMonad's functionality is exposed as a library your xmonad.hs can import and modify at will. So your xmonad.hs boils down to 'main = xmonad $ myCrazyFunkyArgs'.

In Autoproc's case, what you do is create ~/.autoproc/autoproc.hs, and then set things up. (If you don't, Autoproc will use its compiled in configuration, which is surely not what you want.)

While I was testing this Xmonad-style configuration, I created an autoproc.hs that looks like this:

> import Autoproc.Configuration (defaultVariables)
> import Autoproc.Run
> import Autoproc.Rules.Dagit

> main โˆท IO ()
> main =  do print "foo bar"
>            autoprocMain defaultVariables dagitRules

('defaultVariables' provides the key-values of environmental variables, and 'dagitRules' is all the Procmail filtering rules.)

Now, this is the same environmental variables and configuration rules used by default, but there's nothing stopping me from taking defaultVariables and replacing it with

> myVariables = [("SHELL", "/bin/zsh")]

And I can run arbitrary stuff before and after the rules and variables are compiled down to text - my output will start with "foo bar", as useless a customization as that is...

== Running Autoproc ==

To run the autoproc binary and save your rules to the file recipes use the
following command:

  $ autoproc > recipes

If you are familiar with Procmail you may want to examine the file to
see that everything was generated correctly.  Once you are confident
that you would like to use this file, you can simply move it to
$HOME/.procmailrc Depending on your system you may need to do
additional configuration to get Procmail itself running.  Usually this
is done with a .forward file, or on some systems having a .procmailrc
is enough.

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.