2853 (save-excursion |
2853 (save-excursion |
2854 (mark-paragraph) |
2854 (mark-paragraph) |
2855 (python-shell-send-region (point) (mark)))) |
2855 (python-shell-send-region (point) (mark)))) |
2856 (define-key python-mode-map [?\C-c ?\C-h] 'my-python/send-paragraph)) |
2856 (define-key python-mode-map [?\C-c ?\C-h] 'my-python/send-paragraph)) |
2857 |
2857 |
|
2858 (defgroup my/python nil |
|
2859 "My Python extentions in Emacs." |
|
2860 :group 'python) |
|
2861 |
|
2862 (defvar my/python-pylint-command "pylint" |
|
2863 "Command to run pylint executable.") |
|
2864 (defvar my/python-pylint-args "-f parseable" |
|
2865 "Arguments to pass to pylint executable.") |
|
2866 |
|
2867 (defvar my/python-pep8-command "pep8" |
|
2868 "Command to run pep8 executable.") |
|
2869 (defvar my/python-pep8-args "" |
|
2870 "Arguments to pass to pep8 executable.") |
|
2871 |
|
2872 (defvar my/python-pyflakes-command "pyflakes" |
|
2873 "Command to run pyflakes executable.") |
|
2874 (defvar my/python-pyflakes-args "" |
|
2875 "Arguments to pass to pyflakes executable.") |
|
2876 |
|
2877 (defvar my/python-checker-alist |
|
2878 '((pylint . (my/python-pylint-command my/python-pylint-args)) |
|
2879 (pep8 . (my/python-pep8-command my/python-pep8-args)) |
|
2880 (pyflakes . (my/python-pyflakes-command my/python-pyflakes-args))) |
|
2881 "Known Python source code checkers.") |
|
2882 |
|
2883 (defcustom my/python-default-checker 'pyflakes |
|
2884 "Default Python source code checker. See `my/python-checker-alist' for full alist." |
|
2885 :group 'my/python |
|
2886 :type (cons 'choice (mapcar (lambda (e) (cons 'const e)) my/python-checker-alist))) |
|
2887 |
|
2888 (defvar my/python-check-history nil) |
|
2889 |
|
2890 (defun my/python-check (&optional checker) |
|
2891 (interactive |
|
2892 (list |
|
2893 (completing-read "Select cheker: " (mapcar (lambda (e) (car e)) my/python-checker-alist) nil t (symbol-name my/python-default-checker) 'my/python-check-history))) |
|
2894 (let ( entry ) |
|
2895 (unless (setq entry (cdr (assoc (intern-soft checker) my/python-checker-alist))) |
|
2896 (error "Unknown checker...")) |
|
2897 (compilation-start (format "%s %s %s" (symbol-value (car entry)) (symbol-value (cadr entry)) (shell-quote-argument (buffer-file-name)))))) |
|
2898 |
|
2899 (my--eval-after-load python |
|
2900 (define-key python-mode-map [?\C-c ?\C-v] #'my/python-check)) |
2858 |
2901 |
2859 ;; For 3rd party python-mode.el. |
2902 ;; For 3rd party python-mode.el. |
2860 (my--eval-after-load python-mode |
2903 (my--eval-after-load python-mode |
2861 (when (and (boundp 'py-version) (equal py-version "5.1.0")) |
2904 (when (and (boundp 'py-version) (equal py-version "5.1.0")) |
2862 ;; (py-toggle-shells 'cpython) |
2905 ;; (py-toggle-shells 'cpython) |