1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-14 18:10:32 -08:00

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'.
This commit is contained in:
Stefan Kangas 2024-06-29 21:30:19 +02:00
parent 2119cd52cd
commit bc2e9210bf

View file

@ -7042,6 +7042,7 @@ Add import for undefined name `%s' (empty to skip): "
(defvar electric-indent-inhibit)
(defvar prettify-symbols-alist)
(defvar python--installed-grep-hook nil)
;;;###autoload
(define-derived-mode python-base-mode prog-mode "Python"
@ -7126,6 +7127,15 @@ implementations: `python-mode' and `python-ts-mode'."
"`outline-level' function for Python mode."
(1+ (/ (current-indentation) python-indent-offset))))
(unless python--installed-grep-hook
(setq python--installed-grep-hook t)
(with-eval-after-load 'grep
(defvar grep-files-aliases)
(defvar grep-find-ignored-directories)
(cl-pushnew '("py" . "*.py") grep-files-aliases :test #'equal)
(dolist (dir '(".tox" ".venv" ".mypy_cache" ".ruff_cache"))
(cl-pushnew dir grep-find-ignored-directories))))
(setq-local prettify-symbols-alist python-prettify-symbols-alist)
(make-local-variable 'python-shell-internal-buffer)