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

Run pony commands from pony buffers #96

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions src/pony-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -246,22 +246,26 @@ more conservative local-var manipulation."

(defun pony-configfile-p ()
"Establish whether this project has a .ponyrc file in the root"
(if (equal 'dired-mode major-mode)
(if (pony-locate ".dir-locals.el") t nil)
(if (or
(and (buffer-file-name) (dir-locals-find-file (buffer-file-name)))
(pony-rooted-sym-p '.ponyrc))
t nil)))
(if (and (boundp 'dir-local-variables-alist) dir-local-variables-alist)
t
(if (equal 'dired-mode major-mode)
(if (pony-locate ".dir-locals.el") t nil)
(if (or
(and (buffer-file-name) (dir-locals-find-file (buffer-file-name)))
(pony-rooted-sym-p '.ponyrc))
t nil))))

(defun pony-rc ()
"Return the settings for the current project.

Evaluate the pony-settings variable from the directory-local
variables; if not found, evaluate .ponyrc instead."
(dolist (pair (rest (first (pony-read-file (pony-locate ".dir-locals.el")))) res)
(if (equal 'pony-settings (first pair))
(setq res (eval (first (rest pair))))
nil)))
(if (and (boundp 'dir-local-variables-alist) dir-local-variables-alist)
(eval (cadr (car dir-local-variables-alist)))
(dolist (pair (rest (first (pony-read-file (pony-locate ".dir-locals.el")))) res)
(if (equal 'pony-settings (first pair))
(setq res (eval (first (rest pair))))
nil))))

(when (featurep 'files-x)
;;;###autoload
Expand Down