Skip to content

Instantly share code, notes, and snippets.

@jasonm23
Created October 23, 2014 18:25
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 jasonm23/2fefd69d7f9b24a45def to your computer and use it in GitHub Desktop.
Save jasonm23/2fefd69d7f9b24a45def to your computer and use it in GitHub Desktop.
(find-file (replace-regexp-in-string "/views/\\(.*\\)" "/view_models/\\1" (buffer-file-name)))
(setq jump-list
;;- name ------ path in -------- name match -------------------------------- name replacement ----
;; javascript/
;; airdrilling/
'(templates ("/templates/" "/templates/\\(.*\\)\\(\\.hamlc\\)" "/templates/\\1.hamlc")
view_models ("/view_models/" "/view_models/\\(.*\\)\\(\\.js.coffee\\)" "/view_models/\\1\\2")
views ("/views/" "/views/\\(.*\\)\\_view\\(\\.js.coffee\\)" "/views/\\1_view\\2")))
(car (cdr (assoc-string "views" jump-list)))
(car (cdr (assoc-string "view_models" jump-list)))
(car (cdr (assoc-string "templates" jump-list)))
(defun get-path-for (s) (nth 0 (car (cdr (assoc-string s jump-list)))))
(defun get-regex-for (s) (nth 1 (car (cdr (assoc-string s jump-list)))))
(defun get-replace-for (s) (nth 2 (car (cdr (assoc-string s jump-list)))))
(get-path-for "templates")
(get-path-for "views")
(get-path-for "view_models")
(plist-get jump-list 'templates)
(plist-get jump-list 'views)
(plist-get jump-list 'view_models)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment