mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-07 06:50:23 -08:00
Add Python "*.pth" files to auto-mode-alist
* lisp/progmodes/python.el (python--auto-mode-alist-regexp): New variable. (auto-mode-alist, python-ts-mode): Use above new variable.
This commit is contained in:
parent
4c567892e0
commit
2f485e68ff
1 changed files with 9 additions and 2 deletions
|
|
@ -293,8 +293,15 @@
|
|||
(autoload 'comint-mode "comint")
|
||||
(autoload 'help-function-arglist "help-fns")
|
||||
|
||||
(defconst python--auto-mode-alist-regexp
|
||||
(rx "." (or "py"
|
||||
"pth" ; Python Path Configuration File
|
||||
"pyi" ; Python Stub File (PEP 484)
|
||||
"pyw") ; MS-Windows specific extension
|
||||
eos))
|
||||
|
||||
;;;###autoload
|
||||
(add-to-list 'auto-mode-alist (cons (purecopy "\\.py[iw]?\\'") 'python-mode))
|
||||
(add-to-list 'auto-mode-alist (cons python--auto-mode-alist-regexp 'python-mode))
|
||||
;;;###autoload
|
||||
(add-to-list 'interpreter-mode-alist (cons (purecopy "python[0-9.]*") 'python-mode))
|
||||
|
||||
|
|
@ -7208,7 +7215,7 @@ implementations: `python-mode' and `python-ts-mode'."
|
|||
(when python-indent-guess-indent-offset
|
||||
(python-indent-guess-indent-offset))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.py[iw]?\\'" . python-ts-mode))
|
||||
(add-to-list 'auto-mode-alist '(python--auto-mode-alist-regexp . python-ts-mode))
|
||||
(add-to-list 'interpreter-mode-alist '("python[0-9.]*" . python-ts-mode))))
|
||||
|
||||
(derived-mode-add-parents 'python-ts-mode '(python-mode))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue