aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el (follow)
Commit message (Collapse)AuthorAgeFilesLines
* * lisp/progmodes/python.el: Account for new keywords.Colin Woodbury2022-03-121-0/+2
| | | | | | * lisp/progmodes/python.el (python-font-lock-keywords-level-2): As of Python 3.10, Python has structured pattern matching. This adds two new keywords which need to be highlighted (bug#54345).
* python.el: Silence left over warning in last commitStefan Monnier2022-02-041-0/+1
| | | | | | * lisp/progmodes/python.el (python-shell-calculate-process-environment): Declare tramp-remote-process-environment before using it.
* python.el: Try and better split the Tramp codeStefan Monnier2022-02-041-165/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Massage the Python-Tramp code so that the Tramp part and the Python part are a bit less intertwined. It's still not quite right, but it's a bit closer to the point where the Tramp part can be moved to `tramp.el`. * lisp/progmodes/python.el: Don't require `tramp-sh`. Do require `subr-x` OTOH. Remove redundant `:group`s. (python-shell--calculate-process-environment): New function, that only return the entries to be added. (python-shell-calculate-process-environment): Rewrite and declare obsolete. (python-shell-tramp-refresh-remote-path) (python-shell-tramp-refresh-process-environment): Silence compiler warnings. (python-shell-with-environment): Move the bulk of its code to a new function `python-shell--with-environment` for easier debugging and to avoid code duplication. (python-shell--with-environment): New function. Split the Tramp case into its own function. (python-shell--tramp-with-environment): New function. (python-eldoc-function-timeout-permanent): Fix doc's first line. * test/lisp/progmodes/python-tests.el: Adjust accordingly. (python-shell-calculate-process-environment-1) (python-shell-calculate-process-environment-2) (python-shell-calculate-process-environment-3) (python-shell-calculate-process-environment-4) (python-shell-calculate-process-environment-5) (python-shell-calculate-process-environment-6) (python-shell-calculate-process-environment-7) (python-shell-calculate-process-environment-8): Use `python-shell--calculate-process-environment`. (python--tests-process-env-canonical, python--tests-process-env-eql): New functions. (python-shell-with-environment-2, python-shell-with-environment-3): Use them.
* Fix python-eldoc affecting unrelated comint processesMiha Rihtaršič2022-01-141-5/+7
| | | | | | | * lisp/progmodes/python.el (python-shell-send-string-no-output): Don't let-bind comint-preoutput-filter-functions globally for all comint processes. Modify the behaviour of only the current python process (bug#53219).
* Merge from origin/emacs-28Eli Zaretskii2022-01-011-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year. 86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year ebe8772f65 ; Minor fixes related to copyright years 23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye... 8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t. 19dcb237b5 ; Add 2022 to copyright years. # Conflicts: # etc/NEWS # etc/refcards/ru-refcard.tex # lib/cdefs.h # lisp/erc/erc-dcc.el # lisp/erc/erc-imenu.el # lisp/erc/erc-replace.el # lisp/image-dired.el # lisp/progmodes/xref.el # m4/alloca.m4 # m4/byteswap.m4 # m4/errno_h.m4 # m4/getopt.m4 # m4/gnulib-common.m4 # m4/inttypes.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/sys_socket_h.m4
| * ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
| |
* | Merge from origin/emacs-28Stefan Kangas2021-12-131-2/+2
|\ \ | |/ | | | | | | | | | | | | 9bd3f78645 Make `M-x run-python' select the window again 62139aeb42 * lisp/tab-bar.el (tab-bar-switch-to-last-tab): Add 'abs' ... ea8422204f * make-dist (manifest): Filter out msdos/autogen/* files. b5354e989d Rewrite the "Quitting Windows" section of Emacs Lisp Refer... 64ea1a178c Fix eshell for systems that do not have subprocesses
| * Make `M-x run-python' select the window againKévin Le Gouguec2021-12-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Interactively, we want M-x run-python to focus the interpreter buffer. The previous code failed in two ways: - the call to 'display-buffer' was not reached if an interpreter was already running, - set-buffer is ineffectual if the interpreter's window is not selected: once Emacs returns to the command loop, the current buffer will revert back to what the selected window contains. * lisp/progmodes/python.el (python-shell-make-comint): Handle the SHOW argument regardless of whether an interpreter buffer exists, and use pop-to-buffer to select the window. (run-python): Delegate buffer management to 'python-shell-make-comint'. * test/lisp/progmodes/python-tests.el (python-tests--run-python-selects-window): Rename from 'python-tests--bug31398', and adjust assertions (bug#52380).
| * Revert "Make `M-x run-python' select the window again"Lars Ingebrigtsen2021-12-101-2/+2
| | | | | | | | | | | | This reverts commit aa2872a12770282ede3548ed3fcab00c5a5b9f18. This led to a test failure.
| * Make `M-x run-python' select the window againKévin Le Gouguec2021-12-101-2/+2
| | | | | | | | | | * lisp/progmodes/python.el (python-shell-make-comint): Make `M-x run-python' select the window again like in 27.2 (bug#52380).
* | ; Revert "* lisp/progmodes/python.el (python-forward-sexp-function): ↵Eli Zaretskii2021-11-141-1/+1
| | | | | | | | | | | | | | :version fix." This reverts commit e6e29b435273ee9821b6536581bd151f3e50737d. The commit was a mistake.
* | ; * lisp/progmodes/python.el (python-forward-sexp-function): :version fix.Eli Zaretskii2021-11-141-1/+1
| |
* | Fix customization group of python-forward-sexp-functionKévin Le Gouguec2021-11-141-7/+7
| | | | | | | | | | | | | | * lisp/progmodes/python.el (python-forward-sexp-function): Move from the "Flymake integration" subsection to the "Navigation" subsection, so that the option is sorted into the 'python' group rather than the 'python-flymake' group (bug#51807).
* | Make the python missing-readline warning more helpfulBenj2021-11-101-1/+2
| | | | | | | | | | | | | | | | * lisp/progmodes/python.el (python-shell-completion-native-turn-on-maybe): Mention the "readline" package (bug#48998). Copyright-paperwork-exempt: yes
* | Match dummy output even with non-default rl configCarlos Pita2021-11-051-1/+1
| | | | | | | | | | | | * lisp/progmodes/python.el (python-shell-completion-native-get-completions): Match dummy output even when readline is configured in non-default ways. (Bug#51010)
* | 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.