Skip to content

Instantly share code, notes, and snippets.

@aaroncampos
Created December 3, 2010 00:34
Show Gist options
  • Save aaroncampos/726376 to your computer and use it in GitHub Desktop.
Save aaroncampos/726376 to your computer and use it in GitHub Desktop.
YAsnippet / ruby-electric-mode workaround
;; Yasnippet workaround for ruby-electric-mode
;; See: http://code.google.com/p/yasnippet/issues/detail?id=71
(defun yas/advise-indent-function (function-symbol)
(eval `(defadvice ,function-symbol (around yas/try-expand-first activate)
,(format
"Try to expand a snippet before point, then call `%s' as usual"
function-symbol)
(let ((yas/fallback-behavior nil))
(unless (and (interactive-p)
(yas/expand))
ad-do-it)))))
(yas/advise-indent-function 'ruby-indent-line)
@rendekarf
Copy link

thanks mate, i had been looking around a lot for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment