I'm not a lisp guy at all, but my primary scripting environment lives on emacs and I need some help to get my flymake/pyflakes running when there is no .py extension on files. Because some of the scripts here at my work doesn't have .py extension on them.
This is pretty working with pylint, pep8, pychecker etc, when I'm reading/coding a file that has the .py extension.
;; flymake for python
(add-to-list 'load-path "~/.emacs.d/plugins/flymake")
(when (load "flymake" t)
(defun flymake-pylint-init (&optional trigger-type)
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-with-folder-structure))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name)))
(options (when trigger-type (list "--trigger-type" trigger-type))))
(list "~/.emacs.d/plugins/flymake/pyflymake.py" (append options (list local-file)))))
(add-to-list 'flymake-allowed-file-name-masks
'("\\.py\\'" flymake-pylint-init)))
(add-hook 'find-file-hook 'flymake-find-file-hook)
;; flymake help on minibuffer
(defun my-flymake-show-help ()
(when (get-char-property (point) 'flymake-overlay)
(let ((help (get-char-property (point) 'help-echo)))
(if help (message "%s" help)))))
(add-hook 'post-command-hook 'my-flymake-show-help)
I have tried to get this working init snippet when there is no .py extension. I wrapped the code above with python-mode-hook and changed the \.py\ section to something like \.*\.
However this is calling flymake-pylint-init function not only for python files. It calls it anything opened within emacs.
BTW, I'm not able to use m-x flymake-mode on no-extension files, it's not opening that minor mode.
I'd love to get any idea to get it working. thanks!