Commits

camlspotter committed 717a8b6

added readme

Comments (0)

Files changed (1)

+Fed up with pressing TABs hundreds times a day in Haskell programming with the offside rule, I wrote a small elisp:
+
+    http://bitbucket.org/camlspotter/offside-trap/src
+
+This elisp understand nothing about Haskell. It just traps each indentation change of one line, and extends it to its “sticky” lines. Sticky lines are:
+
+- It is below of the cursor line or another sticky line 
+- Its indentation is as deep as or deeper than the cursor line. 
+
+The rule is simple but works nicely:
+
+-------------------------------------------------------------------------
+  hoge = case hoge of
+                   []Foo -> hogehoge             <= The cursor ([]) is here             
+                     Bar -> let x = hogehoge  in <= Sticky
+                            poo poo              <= Sticky
+                     _ -> error "bang"           <= Sticky
+  huga = 2  <= Not sticky
+-------------------------------------------------------------------------
+ 
+Pressing ONLY ONE TAB, I got the following. Puff!:
+
+-------------------------------------------------------------------------
+  hoge = case hoge of
+        []Foo -> hogehoge
+          Bar -> let x = hogehoge  in <= Sticky
+                 poo poo              <= Sticky
+          _ -> error "bang"           <= Sticky
+  huga = 2  <= Not sticky
+-------------------------------------------------------------------------
+
+Of course this “offside trap” only works against codes with correct indentations. But it definitely improved my Haskell coding experience.
+ 
+Jun
+ 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.