aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix return value of python-nav-end-of-defunLars Ingebrigtsen2021-11-041-1/+4
| | | | | * lisp/progmodes/python.el (python-nav-end-of-defun): Return non-nil if in a def/class, as the doc string implies (bug#51601).
* Merge from origin/emacs-28Eli Zaretskii2021-10-311-0/+2
|\ | | | | | | | | 335a660b4b Fix display glitches with side-by-side windows on TTY frames 4a96f32def Avoid replacing common prefix with ellipsis
| * Avoid replacing common prefix with ellipsisCarlos Pita2021-10-301-0/+2
| | | | | | | | | | | | * lisp/progmodes/python.el (python-shell-completion-native-setup): Configure readline not to suppress common prefixes. (Bug#51218)
* | Update Emacs requirement after removing compat codeLars Ingebrigtsen2021-10-131-1/+1
| |
* | Fix problem with multiline fontification in interactive PythonLars Ingebrigtsen2021-10-131-6/+2
| | | | | | | | | | | | | | * lisp/progmodes/python.el (python-shell-font-lock-post-command-hook): When doing multi-line (`C-c SPC') inputs, remove all the preceding lines when doing fontification (bug#47657).
* | Remove some compat code from python.elLars Ingebrigtsen2021-10-131-5/+1
| | | | | | | | | | | | * lisp/progmodes/python.el (python-shell-font-lock-post-command-hook): Remove Emacs 24.3 and earlier compat code.
* | Merge from origin/emacs-28Glenn Morris2021-10-121-1/+1
|\ \ | |/ | | | | | | | | | | | | 66b8dfd060 (origin/emacs-28) ; Fix last change related to shorthands 3832b983cf In Fdelete_other_windows_internal fix new total window siz... 5deb0ec14f * lisp/mh-e/mh-show.el (mh-junk-whitelist): Custom obsoles... cf1409db71 Don't apply shorthands to punctuation-only symbols (bug#51... b3d0f53b29 * lisp/progmodes/python.el: Bump package version to 0.28.
| * * lisp/progmodes/python.el: Bump package version to 0.28.Stefan Kangas2021-10-111-1/+1
| |
| * Fontify "print" and "exec" as functions in python-modeStefan Kangas2021-10-111-3/+0
| | | | | | | | | | | | | | | | | | This change was first made on master, but on closer consideration it is better to fix this bug already in Emacs 28.1. * lisp/progmodes/python.el (python-font-lock-keywords-level-2): Fontify "print" and "exec" as functions, which is the case in Python 3. (Bug#43298) Do not merge to master.
* | Fontify "print" and "exec" as functions in python-modeStefan Kangas2021-10-111-3/+0
| | | | | | | | | | | | * lisp/progmodes/python.el (python-font-lock-keywords-level-2): Fontify "print" and "exec" as functions, which is the case in Python 3. (Bug#43298)
* | Use format-prompt for many more promptsStefan Kangas2021-10-051-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/bookmark.el (bookmark-completing-read): * lisp/calc/calc-prog.el (calc-user-define-formula): * lisp/calc/calc-store.el (calc-permanent-variable): * lisp/calc/calc-units.el (calc-convert-units) (calc-convert-exact-units, calc-convert-temperature): * lisp/cedet/semantic/complete.el (semantic-complete-read-tag-engine): * lisp/cus-edit.el (customize-read-group): * lisp/dired-aux.el (dired-do-chxxx): * lisp/dired-x.el (dired-mark-unmarked-files): * lisp/emacs-lisp/debug.el (cancel-debug-on-entry) (cancel-debug-on-variable-change): * lisp/emacs-lisp/edebug.el (edebug-cancel-on-entry) (edebug-remove-instrumentation): * lisp/epa.el (epa-read-file-name, epa-export-keys): * lisp/faces.el (read-face-name): * lisp/format.el (format-decode-buffer, format-decode-region): * lisp/gnus/gnus-art.el (gnus-read-save-file-name): * lisp/gnus/gnus-util.el (gnus-completing-read): * lisp/gnus/message.el (message-check-news-header-syntax): * lisp/info.el (Info-follow-reference): * lisp/international/mule-diag.el (describe-font) (describe-fontset): * lisp/international/quail.el (quail-show-keyboard-layout): * lisp/language/cyril-util.el (standard-display-cyrillic-translit): * lisp/mail/rmailkwd.el (rmail-read-label): * lisp/mail/rmailmm.el (rmail-mime-save): * lisp/mail/rmailout.el (rmail-output-read-file-name): * lisp/man.el (Man-goto-section, Man-follow-manual-reference): * lisp/menu-bar.el (emacs-index--prompt): * lisp/net/ange-ftp.el (ange-ftp-get-passwd): * lisp/proced.el (proced-send-signal): * lisp/progmodes/cpp.el (cpp-choose-face): * lisp/progmodes/ebrowse.el (ebrowse-set-tree-indentation): * lisp/progmodes/etags.el (visit-tags-table) (visit-tags-table-buffer): * lisp/progmodes/grep.el (grep-read-files): * lisp/progmodes/hideif.el (hide-ifdef-define): * lisp/progmodes/pascal.el (pascal-goto-defun): * lisp/progmodes/prolog.el (prolog-read-predicate): * lisp/progmodes/sql.el (sql-get-login-ext): * lisp/ses.el (ses-define-local-printer): * lisp/textmodes/artist.el (artist-figlet-choose-font): * lisp/textmodes/tex-mode.el (tex-compile): * lisp/vc/diff.el (diff): * lisp/vc/ediff-ptch.el (ediff-prompt-for-patch-file): * lisp/vc/ediff-util.el (ediff-read-file-name): * lisp/vc/pcvs.el (cvs-mode-mark-on-state): * lisp/vc/vc.el (vc-diff-build-argument-list-internal) (vc-revision-other-window, vc-retrieve-tag): * lisp/wid-edit.el: Prefer format-prompt unconditionally. * lisp/org/org-capture.el (org-capture-fill-template): * lisp/org/org-refile.el (org-refile-get-location): * lisp/progmodes/python.el (python-eldoc-at-point): * lisp/progmodes/verilog-mode.el (verilog-surelint-off) (verilog-goto-defun): * lisp/progmodes/xref.el (xref--read-identifier): Prefer format-prompt when it is fboundp.
* | Avoid a warning in python-eldoc-setup-codeCarlos Pita2021-10-041-1/+4
|/ | | | | * lisp/progmodes/python.el (python-eldoc-setup-code): Avoid a deprecation warning about formatargspec (bug#50996).
* * python.el (python-syntax-stringify): Extend comment about last changeStefan Monnier2021-09-211-0/+7
|
* Make syntax-ppss more accurate for Python triple quotes (bug#49518)João Távora2021-09-211-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | By putting delimiter syntax on the last character of Python triple-quoted strings, this makes syntax-ppss be more accurate. Previously: emacs -Q something.py type two single quotes M-: (nth 3 (syntax-ppss)) notice how the return value says you're outside a string, correctly type another quote M-: (nth 3 (syntax-ppss)) notice how the return value says you're inside a string, correctly backspace the quote just entered M-: (nth 3 (syntax-ppss)) notice how the return value says you're inside a string, incorrectly With this patch the last step is corrected. This helps things like electric-pair-mode. Also, the test python-syntax-after-python-backspace now passes, again. * lisp/progmodes/python.el (python-syntax-stringify): Put delimiter syntax in "inner" of the surrouding triple quotes. * test/lisp/progmodes/python-tests.el (python-syntax-after-python-backspace): Passes again.
* ; Minor stylistic fixes found by checkdocStefan Kangas2021-09-161-11/+10
|
* Tweak python-hideshow-forward-sexp-function warning avoidanceLars Ingebrigtsen2021-09-151-2/+1
| | | | | | | * lisp/progmodes/python.el (python-hideshow-forward-sexp-function): Avoid compilation warning in a more standard way. Problem reported in https://thedailywtf.com/articles/the-programmer-s-motto-and-other-comments
* Python shell: rearrange printing of newline before outputAugusto Stoffel2021-09-151-4/+8
| | | | | | | | | | * progmodes/python.el (python-shell-output-filter-in-progress) (python-shell-output-filter-buffer): Move defvars to avoid compiler warnings. (python-shell-eval-setup-code): Don't print a newline in __PYTHON_EL_eval. (python-shell-send-string): Insert newline before output when applicable (bug#50514).
* Keep python.el compatible with older EmacsenAugusto Stoffel2021-09-111-1/+3
| | | | | * progmodes/python.el (python-shell-send-string): Don't assume comint-max-line-length is defined (bug#50503).
* Allow using 'python-shell-send-file' across machinesAugusto Stoffel2021-09-111-15/+30
| | | | | | | | | * progmodes/python.el (python-shell-eval-file-setup-code): Look for a file coding cookie on the Python rather than on the Emacs side, to avoid additional file transfers. (python-shell--save-temp-file): Allow argument to be a buffer. (python-shell-send-file): Address the case where the selected file and the inferior process are on different machines (bug#50516).
* Implement caching for 'python-shell-completion-at-point'Augusto Stoffel2021-09-111-29/+30
| | | | | | | | | | | | | * lisp/progmodes/python.el (python-shell-completion-at-point): cache results, since computing them involves talking with the inferior process and, potentially, network communications (python-shell--capf-cache): new variable, for cache (python-shell-completion-get-completions) (python-shell-completion-native-get-completions): 'import' argument is not needed anymore. (python-shell-completion-native-setup) (python-shell-completion-native-try): pass the setup code synchronously, to avoid printing a message in the shell (bug#50459).
* Revert usage of format-prompt in python.elLars Ingebrigtsen2021-09-101-1/+3
| | | | | | * lisp/progmodes/python.el (python-eldoc-at-point): Revert usage of format-prompt in python.el since this is also an ELPA package (and older Emacs versions doesn't have format-prompt).
* Properly encode all strings sent to Python shellAugusto Stoffel2021-09-101-43/+21
| | | | | | | | | | * lisp/progmodes/python.el: Now depends on Emacs 28. (python-shell-package-enable, python-shell-completion-get-completions) (python-ffap-module-path, python-eldoc--get-doc-at-point): Enconde Python strings using 'python-shell--encode-string' instead of triple quotes. (python-shell-completion-string-code, python-eldoc-string-code) (python-ffap-string-code): Remove defcustoms. (bug#50503).
* ; * lisp/progmodes/python.el (python-shell-send-string): Fix last change.Eli Zaretskii2021-09-091-1/+1
|
* Fix a recent change wrt 'comint-max-line-length'Eli Zaretskii2021-09-091-1/+2
| | | | | | | | | * lisp/progmodes/python.el (python-shell-send-string): Only heed 'comint-max-line-length' for subprocesses with which we communicate via PTYs. (Bug#49822) * lisp/comint.el (comint-max-line-length): Doc fix. Add a value for MS-Windows.
* Better treatment of line length limits for the Python inferiorAugusto Stoffel2021-09-091-47/+51
| | | | | | | | | | | | | | | * lisp/comint.el (comint-max-line-length): New constant reflecting a safe maximum line size that can be sent to an inferior process. * lisp/progmodes/python.el (python-shell-comint-watch-for-first-prompt-output-filter): Send setup code to the inferior process only once and at this stage. (python-shell-eval-setup-code, python-shell-eval-file-setup-code): Move, unchanged, to an earlier point to avoid byte-compiler warnings. (python-shell-send-string-no-output): Revert changes of e32c7d2a8d (python-shell-send-string): Use 'comint-max-line-length' to decide when to resort to temp files. (python-shell-send-string, python-shell-send-file): Don't send setup code each time (bug#49822).
* Don't disable ipython as a native interpreterLars Ingebrigtsen2021-09-081-4/+3
| | | | | | | * lisp/progmodes/python.el (python-shell-completion-native-disabled-interpreters): Remove ipython from list, because it apparently works fine these days (bug#50458).
* Fixes for 'python-shell-send-string' and 'python-shell-send-file'Augusto Stoffel2021-09-051-15/+31
| | | | | | | * lisp/progmodes/python.el (python-shell-send-string): use a temporary file for sufficiently long strings. (python-shell-send-file, python-shell-eval-file-setup-code): Avoid showing "plumbing code" in the traceback (bug#32042).
* Change Python eval to send directly instead of using temporary filesAugusto Stoffel2021-09-031-14/+50
| | | | | | | | | | * lisp/progmodes/python.el (python-shell-eval-setup-code): New const for setting up eval (bug#49822). (python-shell--encode-string): New function. (python-shell-send-string): Use it to send commands directly instead of writing to a temporary file. (python-shell-send-string-no-output): Adjust sending. (python-shell-send-file): Ditto.
* python-shell-interpreter doc string clarificationLars Ingebrigtsen2021-08-271-1/+6
| | | | | * lisp/progmodes/python.el (python-shell-interpreter): Note what to do when using ipython3 (bug#44732).
* Allow evaluating Python code across machinesAugusto Stoffel2021-08-151-1/+2
| | | | | * python.el (python-shell-send-string): Ensure that the temporary file is created in the host running the Python process (bug#50057).
* Add new user option python-forward-sexp-functionLars Ingebrigtsen2021-07-311-9/+9
| | | | | | * lisp/progmodes/python.el (python-forward-sexp-function): New user option (bug#41361). (python-mode): Use it.
* Fix filling of overlong first lines in Python doc stringsDeneb Meketa2021-05-271-1/+6
| | | | | | | * lisp/progmodes/python.el (python-fill-string): Fill overlong first lines correctly (bug#20860). Copyright-paperwork-exempt: yes
* ; Remove some useless commentsStefan Kangas2021-04-161-2/+0
|
* Fix python-shell-switch-to-shell redisplay bugShitikanth Kashyap2021-04-121-1/+2
| | | | | | | * lisp/progmodes/python.el (python-shell-switch-to-shell): Redisplay the switched-to window faster (bug#47679). Copyright-paperwork-exempt: yes
* Remove redundant #' before lambda in progmodes/*.elStefan Kangas2021-04-011-4/+4
| | | | | | | | | | | * lisp/progmodes/cc-styles.el (c-set-offset): * lisp/progmodes/ebnf-yac.el (ebnf-yac-token-table): * lisp/progmodes/ebnf2ps.el (ebnf-format-float, ebnf-map-name): * lisp/progmodes/grep.el (lgrep, rgrep-default-command): * lisp/progmodes/inf-lisp.el: * lisp/progmodes/octave.el (octave-lookfor): * lisp/progmodes/python.el (python-pdbtrack-tracking-finish): Remove redundant #' before lambda.
* Revert "Do interactive mode tagging for python.el navigation functions."Lars Ingebrigtsen2021-02-181-18/+18
| | | | | | This reverts commit 546f552e7b2439b482c7d28222fb88761a9c876a. This is a "core package", so can't use the new syntax.
* Do interactive mode tagging for python.el navigation functions.Doug Davis2021-02-181-18/+18
| | | | | | * lisp/progmodes/python.el (navigation functions): Add python-mode to `interactive' declarations for mode-specific commands (bug#46610). Copyright-paperwork-exempt: yes
* Deactivate region in `C-c C-r' in python-modeLars Ingebrigtsen2021-02-041-1/+2
| | | | | | * lisp/progmodes/python.el (python-shell-send-region): Deactivate mark after executing (bug#28789). This is how this command worked in Emacs 24, apparently.
* Default python-shell-interpreter to python3Glenn Morris2021-01-101-1/+5
| | | | | * lisp/progmodes/python.el (python-shell-interpreter): Default to python3 (bug#45655).
* Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* Make python-mode fontify more assignment statementsDario Gjorgjevski2020-12-211-27/+69
| | | | | | | | * lisp/progmodes/python.el (python-font-lock-assignment-matcher): New function to match assignment statements. (python-rx): Add `assignment-target' and `grouped-assignment-target'. (python-font-lock-keywords-maximum-decoration): Add new matchers (bug#45341).
* Fix narrow-to-defun in python-modeTomas Nordin2020-12-141-4/+11
| | | | | | | * lisp/progmodes/python.el (python-nav--beginning-of-defun): Make narrow-to-defun work better in classes (bug#40563). Copyright-paperwork-exempt: yes
* Prefer setq-local in python.elStefan Kangas2020-12-121-79/+71
| | | | | | | | | | | | | * lisp/progmodes/python.el: Require Emacs 24.2 instead of 24.1. (python-indent-guess-indent-offset) (python-shell-font-lock-with-font-lock-buffer) (python-shell-font-lock-turn-on) (python-shell-font-lock-turn-off, python-shell-font-lock-toggle) (python-shell-comint-watch-for-first-prompt-output-filter) (inferior-python-mode, python-shell-completion-native-turn-off) (python-shell-completion-native-turn-on) (python-pdbtrack-comint-output-filter-function, python-mode): Prefer setq-local.
* * lisp/progmodes/python.el: Bump version.Stefan Kangas2020-12-111-1/+1
|
* Recompute error positions in python-shell-send-regionLars Ingebrigtsen2020-12-031-0/+6
| | | | | * lisp/progmodes/python.el (python-shell-send-region): Recompute line positions when evaluating (bug#22934).
* Remove redundant installation instructionsStefan Kangas2020-11-121-8/+1
| | | | | | | | | | | | | | | | | | | | | | * lisp/net/newsticker.el: * lisp/net/sieve-mode.el: * lisp/play/bubbles.el: * lisp/play/handwrite.el: * lisp/progmodes/python.el: * lisp/progmodes/ruby-mode.el: * lisp/whitespace.el: Remove redundant installation instructions. These packages are distributed with Emacs and/or GNU ELPA. * lisp/calendar/timeclock.el: * lisp/ehelp.el: * lisp/emacs-lisp/checkdoc.el: * lisp/filesets.el: * lisp/mail/reporter.el: * lisp/net/rfc2104.el: * lisp/net/webjump.el: * lisp/pixel-scroll.el: Remove redundant recommendation to call require before using autoloaded functions. * lisp/tar-mode.el: Remove reference to package uncompress, removed in Emacs 23.
* Fix python-font-lock-keywords-maximum-decoration performance regressionDario Gjorgjevski2020-11-111-11/+8
| | | | | | | * lisp/progmodes/python.el (python-font-lock-keywords-maximum-decoration): `symbol-name' should not be quantified by a `+' as it is redundant and performs very badly (bug#44572).
* Fix font lock of assignments with type hints in PythonDario Gjorgjevski2020-11-111-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/python.el (python-font-lock-keywords-maximum-decoration): Fix regular expressions for font lock of assignments with type hints (bug#44568). The font lock of assignments with type hints in Python is rather bad. Consider the following example: from typing import Mapping, Tuple, Sequence var1: int = 5 var2: Mapping[int, int] = {10: 1024} var3: Mapping[Tuple[int, int], int] = {(2, 5): 32} var4: Sequence[Sequence[int]] = [[1], [1, 2], [1, 2, 3]] var5: Sequence[Mapping[str, Sequence[str]]] = [ { 'red': ['scarlet', 'vermilion', 'ruby'], 'green': ['emerald green', 'aqua'] }, { 'sword': ['cutlass', 'rapier'] } ] As things stand right now, only ‘var1’ would be highlighted. To make things worse, the ‘Mapping’ type hint of ‘var2’ would also be highlighted, which is entirely incorrect. This commit makes all of ‘var1’ through ‘var5’ be highlighted correctly.
* Make the SHOW parameter work again in `run-python'Lars Ingebrigtsen2020-11-091-1/+1
| | | | | * lisp/progmodes/python.el (run-python): Make the SHOW parameter work again after the fix for 31398 (bug#44421).
* Fix misuses of `make-local-variable` on hooksStefan Monnier2020-11-041-2/+2
| | | | | | | | | | | | | | * lisp/vc/smerge-mode.el (smerge-ediff): * lisp/progmodes/python.el (python-pdbtrack-setup-tracking): * lisp/net/tramp-smb.el (tramp-smb-call-winexe): * lisp/net/secrets.el (secrets-mode): * lisp/mail/rmail.el (rmail-variables): * lisp/ielm.el (inferior-emacs-lisp-mode): * lisp/erc/erc-log.el (erc-log-setup-logging): Use `add-hook`. * lisp/eshell/em-unix.el (eshell/diff): * lisp/eshell/em-hist.el (eshell-hist-initialize): Don't `make-local-variable` on hooks.