diff --git a/zdi.el b/zdi.el index 736a335..22f9fa3 100644 --- a/zdi.el +++ b/zdi.el @@ -21,4 +21,17 @@ (set (make-local-variable 'compile-command) (format zdi-build-command-format (projectile-get-relative-path-buffer)))) +(defun zdi-find-spec-file () + "Go to the spec file corresponding to the currently visited file. + +Depends on file naming convention used in Help Center." + (interactive) + (find-file (zdi-build-spec-path (buffer-file-name)))) + +(defun zdi-build-spec-path (path) + "Guess the location of the spec file corresponding to PATH." + (replace-regexp-in-string + "\\(\\)\\.[^\\.]*$" "_spec" + (replace-regexp-in-string "\\(app\\).*\\'" "spec" path nil nil 1) nil nil 1)) + ;;; zdi.el ends here