more snippets and a bug fix: strange (= nil nil) will cause error in elisp.

This commit is contained in:
Zhang Chiyuan 2008-03-06 14:33:13 +00:00
parent 8ef771a696
commit c45eff49e2
11 changed files with 45 additions and 3 deletions

3
snippets/ruby-mode/# Normal file
View File

@ -0,0 +1,3 @@
#name : # =>
# --
# =>

3
snippets/ruby-mode/am Normal file
View File

@ -0,0 +1,3 @@
#name : alias_method new, old
# --
alias_method :${new_name}, :${old_name}

6
snippets/ruby-mode/case Normal file
View File

@ -0,0 +1,6 @@
#name : case ... end
# --
case ${1:object}
when ${2:condition}
$0
end

5
snippets/ruby-mode/forin Normal file
View File

@ -0,0 +1,5 @@
#name : for ... in ...; ... end
# --
for ${1:element} in ${2:collection}
$0
end

5
snippets/ruby-mode/if Normal file
View File

@ -0,0 +1,5 @@
#name : if ... end
# --
if ${1:condition}
$0
end

7
snippets/ruby-mode/ife Normal file
View File

@ -0,0 +1,7 @@
#name : if ... else ... end
# --
if ${1:condition}
$2
else
$3
end

View File

@ -0,0 +1,3 @@
#name : inject(...) { |...| ... }
# --
inject(${1:0}) { |${2:injection}, ${3:element}| $0 }

3
snippets/ruby-mode/rb Normal file
View File

@ -0,0 +1,3 @@
#name : /usr/bin/ruby -wKU
# --
#!/usr/bin/ruby -wKU

View File

@ -0,0 +1,3 @@
#name : reject { |...| ... }
# --
reject { |${1:element}| $0 }

View File

@ -0,0 +1,3 @@
#name : select { |...| ... }
# --
select { |${1:element}| $0 }

View File

@ -27,7 +27,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; User customizable variables
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar yas/key-syntaxes (list "w" "w_")
(defvar yas/key-syntaxes (list "w" "w_" "w_." "^ ")
"A list of syntax of a key. This list is tried in the order
to try to find a key. For example, if the list is '(\"w\" \"w_\").
And in emacs-lisp-mode, where \"-\" has the syntax of \"_\":
@ -137,8 +137,9 @@ mode will be listed under the menu \"yasnippet\".")
(yas/snippet-groups snippet)
:test
'(lambda (field group)
(= (yas/field-number field)
(yas/group-number group))))))
(and (not (null (yas/field-number field)))
(= (yas/field-number field)
(yas/group-number group)))))))
(if group
(yas/group-add-field group field)
(push (yas/make-group field snippet)