Skip to content

Instantly share code, notes, and snippets.

@mori-dev
Forked from WaYdotNET/align.el
Created November 15, 2010 15:09

Revisions

  1. mori revised this gist Nov 15, 2010. 2 changed files with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion align.el
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,14 @@
    ;;
    ;; my answer
    (defun align-to-comma (begin end)
    "Align region to comma signs"
    (interactive "r")
    (align-regexp begin end
    ",\\(\\s-*\\)[^# \t\n]" 1 1))




    ;;;;
    (defun align-to-comma (begin end)
    "Align region to comma signs"
    (interactive "r")
    File renamed without changes.
  2. @WaYdotNET WaYdotNET created this gist Nov 15, 2010.
    13 changes: 13 additions & 0 deletions align.el
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    ;;
    (defun align-to-comma (begin end)
    "Align region to comma signs"
    (interactive "r")
    (align-regexp begin end
    (rx (group (zero-or-more (syntax whitespace))) ",") 1 1 ))


    ;; or comma not refactor
    (defun align-to-comma2 (begin end)
    "Align region to equal signs"
    (interactive "r")
    (align-regexp begin end "\\(\\s-+\\)," 1 1 ))
    24 changes: 24 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    # FROM:
    class Demo
    property :id, Ciao
    property :demo, String
    property :foo, Bar
    end


    # with my align.el
    class Demo
    property :id , Ciao
    property :demo , String
    property :foo , Bar
    end


    # my target is:
    class Demo
    property :id, Ciao
    property :demo, String
    property :foo, Bar
    end