mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 05:23:04 +00:00
tweaking rails snippets slightly
This commit is contained in:
parent
485f34921b
commit
ba638c28a1
@ -3,7 +3,8 @@
|
||||
;; stolen from rinari-mode's rinari-root
|
||||
(defun yas/rails-root (&optional dir)
|
||||
(or dir (setq dir default-directory))
|
||||
(or yas/rails-root-cache
|
||||
(or (and (featurep 'rinari) (rinari-root dir))
|
||||
yas/rails-root-cache
|
||||
(if (file-exists-p (expand-file-name
|
||||
"environment.rb" (expand-file-name "config" dir)))
|
||||
(set (make-local-variable 'yas/rails-root-cache) dir)
|
||||
@ -134,8 +135,9 @@
|
||||
(and (yas/rails-root)
|
||||
(string-match "db/migrate/" default-directory)))
|
||||
|
||||
(defun yas/rails-activate-maybe
|
||||
(when (yas/rails-root)
|
||||
(defun yas/rails-activate-maybe ()
|
||||
(when (and yas/minor-mode
|
||||
(yas/rails-root))
|
||||
(set (make-local-variable 'yas/mode-symbol) 'rails-mode)))
|
||||
|
||||
(defadvice cd (after yas/rails-on-cd-activate activate)
|
||||
@ -144,4 +146,4 @@ are recognized. Stolen from `rinari-mode' more or`' less."
|
||||
(setq yas/rails-root-cache nil)
|
||||
(yas/rails-activate-maybe))
|
||||
|
||||
(add-hook 'find-file-hook 'yas/rails-activate-maybe)
|
||||
(add-hook 'yas/minor-mode-hook 'yas/rails-activate-maybe)
|
||||
|
@ -4,4 +4,8 @@
|
||||
# name: Go to Controller
|
||||
# binding: C-c g c
|
||||
# --
|
||||
(call-interactively (find-file (concat (yas/rails-root) "/app/controllers")))
|
||||
(if (featurep 'rinari)
|
||||
(call-interactively 'rinari-find-controller)
|
||||
(let ((default-directory (concat (yas/rails-root) "/app/controllers/")))
|
||||
(call-interactively 'find-file )))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user