diff options
| author | Stefan Kangas | 2024-06-29 21:30:19 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2024-06-29 21:37:24 +0200 |
| commit | bc2e9210bf9f09e69a119ad998e05b2123113b5c (patch) | |
| tree | 6ebf355b20cd423f298cb569844a94a26308c019 /lisp/progmodes/python.el | |
| parent | 2119cd52cdb58221a850360bf65c91cf3bf4b47e (diff) | |
| download | emacs-bc2e9210bf9f09e69a119ad998e05b2123113b5c.tar.gz emacs-bc2e9210bf9f09e69a119ad998e05b2123113b5c.zip | |
Support grep.el better in `python-base-mode`
* lisp/progmodes/python.el (python-base-mode): When mode is first
enabled, add *.py alias to 'grep-files-aliases', and add common Python
tooling directories to 'grep-find-ignored-directories'.
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 89eefd1f08a..73d6bdd2d2d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -7042,6 +7042,7 @@ Add import for undefined name `%s' (empty to skip): " | |||
| 7042 | 7042 | ||
| 7043 | (defvar electric-indent-inhibit) | 7043 | (defvar electric-indent-inhibit) |
| 7044 | (defvar prettify-symbols-alist) | 7044 | (defvar prettify-symbols-alist) |
| 7045 | (defvar python--installed-grep-hook nil) | ||
| 7045 | 7046 | ||
| 7046 | ;;;###autoload | 7047 | ;;;###autoload |
| 7047 | (define-derived-mode python-base-mode prog-mode "Python" | 7048 | (define-derived-mode python-base-mode prog-mode "Python" |
| @@ -7126,6 +7127,15 @@ implementations: `python-mode' and `python-ts-mode'." | |||
| 7126 | "`outline-level' function for Python mode." | 7127 | "`outline-level' function for Python mode." |
| 7127 | (1+ (/ (current-indentation) python-indent-offset)))) | 7128 | (1+ (/ (current-indentation) python-indent-offset)))) |
| 7128 | 7129 | ||
| 7130 | (unless python--installed-grep-hook | ||
| 7131 | (setq python--installed-grep-hook t) | ||
| 7132 | (with-eval-after-load 'grep | ||
| 7133 | (defvar grep-files-aliases) | ||
| 7134 | (defvar grep-find-ignored-directories) | ||
| 7135 | (cl-pushnew '("py" . "*.py") grep-files-aliases :test #'equal) | ||
| 7136 | (dolist (dir '(".tox" ".venv" ".mypy_cache" ".ruff_cache")) | ||
| 7137 | (cl-pushnew dir grep-find-ignored-directories)))) | ||
| 7138 | |||
| 7129 | (setq-local prettify-symbols-alist python-prettify-symbols-alist) | 7139 | (setq-local prettify-symbols-alist python-prettify-symbols-alist) |
| 7130 | 7140 | ||
| 7131 | (make-local-variable 'python-shell-internal-buffer) | 7141 | (make-local-variable 'python-shell-internal-buffer) |