Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for prefix to ignore for app finding #59

Open
justinabrahms opened this issue Sep 4, 2012 · 2 comments
Open

Support for prefix to ignore for app finding #59

justinabrahms opened this issue Sep 4, 2012 · 2 comments

Comments

@justinabrahms
Copy link

In my company's django project, we have all of our apps in an "apps" directory. The pony-get-app function always returns apps rather than "integration" or what-have-you. This was my solution for it.

;; should probably be customization field?
(setq pony-app-dir-prefix "apps")

(defun pony-get-app ()
  "Return the name of the current app, or nil if no app
found. Corrects for excluded prefix."
  (let* ((root (pony-project-root))
     (excluded-prefix (if (nil-blank-string pony-app-dir-prefix)
                  (concat root pony-app-dir-prefix "/")
                root))
         (re (concat "^" (regexp-quote excluded-prefix) "\\([A-Za-z_]+\\)/"))
         (path (or buffer-file-name (expand-file-name default-directory))))
    (when (string-match re path)
      (match-string 1 path)))))
@davidmiller
Copy link
Owner

Most likely to turn this into a .dir-locals setting...
At which point you'd set it at the directory above all your company's Django source & this would work for your case IIUC

@justinabrahms
Copy link
Author

This would work for my usecase. I'm just using the hacked up version I pasted above, but that will be better. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants