Skip to content

Instantly share code, notes, and snippets.

@rlb3
Created March 29, 2013 19:36
Show Gist options
  • Select an option

  • Save rlb3/5273076 to your computer and use it in GitHub Desktop.

Select an option

Save rlb3/5273076 to your computer and use it in GitHub Desktop.
(require 's)
(defun rlb3/toggle-file ()
(interactive)
(let* ((full-path (buffer-file-name))
(path (rlb3/remove-ulc full-path))
(file-type (rlb3/determine-file-type path)))
(if (eq file-type 'test)
(rlb3/jump-to-related-test path)
(rlb3/jump-to-related-module path))))
(defun rlb3/remove-ulc (path)
(let ((new-path (s-chop-prefix "/usr/local/cpanel/" path )))
new-path))
(defun rlb3/determine-file-type (path)
(cond ((s-ends-with? ".pm" full-path) 'test)
((s-ends-with? ".t" full-path) 'module)))
(defun rlb3/jump-to-related-test (path)
(find-file path))
(rlb3/determine-file-type (rlb3/remove-ulc "/usr/local/cpanel/t/Cpanel-SSLInstall.t"))
(rlb3/determine-file-type (rlb3/remove-ulc "/usr/local/cpanel/Cpanel/SSLInstall.pm"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment