Skip to content

Instantly share code, notes, and snippets.

@mori-dev
Forked from WaYdotNET/align.el
Created November 15, 2010 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mori-dev/700450 to your computer and use it in GitHub Desktop.
Save mori-dev/700450 to your computer and use it in GitHub Desktop.
;; 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")
(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 ))
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment