(when (load "flymake" t) (defun flymake-pyflakes-init () (let* ((temp-file (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace)) (local-file (file-relative-name temp-file (file-name-directory buffer-file-name)))) (list "pyflakes" (list local-file)))) (add-to-list 'flymake-allowed-file-name-masks '("\\.py\\'" flymake-pyflakes-init))) (add-hook 'python-mode-hook 'flymake-mode)We can change the code to use the Emacs Lisp make-temp-file:
(defun flymake-create-temp-in-system-tempdir (filename prefix) (make-temp-file (or prefix "flymake"))) (when (load "flymake" t) (defun flymake-pyflakes-init () (let* ((temp-file (flymake-init-create-temp-buffer-copy 'flymake-create-temp-in-system-tempdir)) (local-file (file-relative-name temp-file (file-name-directory buffer-file-name)))) (list "pyflakes" (list local-file)))) (add-to-list 'flymake-allowed-file-name-masks '("\\.py\\'" flymake-pyflakes-init))) (add-hook 'python-mode-hook 'flymake-mode)
I give credit to http://github.com/purcell/emacs.d/blob/master/site-lisp/flymake-ruby/flymake-ruby.el for showing how it can be done for editing Ruby environments.
Another thing that can be done is to move all Emacs temporary files to the /tmp dir, or your own ~/.emacs.d/tmp directory:
(setq temporary-file-directory "~/.emacs/tmp") (setq backup-directory-alist `((".*" . ,temporary-file-directory))) (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))
Thanks for this. I use Dropbox to back up my code and it's always needlessly sending these files back and forth. Now it isn't!
ReplyDelete