Skip to content

Commit

Permalink
Add new elisp function `etsy-convert-method-parameters'
Browse files Browse the repository at this point in the history
  • Loading branch information
mon-key committed Jul 28, 2012
1 parent ca9dfa1 commit 0cbf359
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cl-etsy-elisp-regexps.el
Expand Up @@ -15,6 +15,25 @@
":association \\1\n:visibility \\2\n:perm-scope \\3\n:type \\4\n:description \"\\5\"\n" t)))
(widen)))))

(defun etsy-convert-method-parameters (start end)
(interactive "r")
(save-excursion
(save-restriction
(unwind-protect
(progn
(narrow-to-region start end)
(goto-char -1)
(while
(search-forward-regexp "\\(.*\\) \t\\(.*\\) \t\\(.*\\) \t\\(.*\\)" nil t)
(let ((match-dash (downcase (subst-char-in-string 95 45 (match-string-no-properties 1))))
(match-req (cond ((equal (match-string-no-properties 2) "Y")
"T")
((equal (match-string-no-properties 2) "N")
"NIL")
(t (match-string-no-properties 2)))))
(replace-match (concat ":name :" match-dash "\n:required " match-req "\n:default \\3\n:type \"\\4\"\n") t))))
(widen)))))

(defun etsy-convert-fields (start end)
(interactive "r")
(save-excursion
Expand Down

0 comments on commit 0cbf359

Please sign in to comment.