Augusto Stoffel
195da78e2e
Properly encode all strings sent to Python shell
...
* 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).
2021-09-10 16:39:13 +02:00
Eli Zaretskii
ceb60225ba
; * lisp/progmodes/python.el (python-shell-send-string): Fix last change.
2021-09-09 21:04:13 +03:00
Eli Zaretskii
bac632aaec
Fix a recent change wrt 'comint-max-line-length'
...
* 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.
2021-09-09 20:08:56 +03:00
Augusto Stoffel
e27385ec37
Better treatment of line length limits for the Python inferior
...
* 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).
2021-09-09 15:48:37 +02:00
Lars Ingebrigtsen
afddd5529d
Don't disable ipython as a native interpreter
...
* lisp/progmodes/python.el
(python-shell-completion-native-disabled-interpreters): Remove
ipython from list, because it apparently works fine these days
(bug#50458).
2021-09-08 08:59:29 +02:00
Augusto Stoffel
1fdd898704
Fixes for 'python-shell-send-string' and 'python-shell-send-file'
...
* 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).
2021-09-05 09:43:13 +02:00
Augusto Stoffel
e32c7d2a8d
Change Python eval to send directly instead of using temporary files
...
* 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.
2021-09-03 14:26:51 +02:00
Lars Ingebrigtsen
9c1bbad907
python-shell-interpreter doc string clarification
...
* lisp/progmodes/python.el (python-shell-interpreter): Note what
to do when using ipython3 (bug#44732).
2021-08-27 04:49:57 +02:00
Augusto Stoffel
926eeb7dd4
Allow evaluating Python code across machines
...
* python.el (python-shell-send-string): Ensure that the temporary file
is created in the host running the Python process (bug#50057).
2021-08-15 14:00:49 +02:00
Lars Ingebrigtsen
2dcb0f8f52
Add new user option python-forward-sexp-function
...
* lisp/progmodes/python.el (python-forward-sexp-function): New
user option (bug#41361).
(python-mode): Use it.
2021-07-31 18:44:02 +02:00
Deneb Meketa
7f11dea662
Fix filling of overlong first lines in Python doc strings
...
* lisp/progmodes/python.el (python-fill-string): Fill overlong
first lines correctly (bug#20860).
Copyright-paperwork-exempt: yes
2021-05-27 01:21:59 +02:00
Stefan Kangas
289ec2d911
; Remove some useless comments
2021-04-16 14:54:02 +02:00
Shitikanth Kashyap
f2ab4cec7a
Fix python-shell-switch-to-shell redisplay bug
...
* lisp/progmodes/python.el (python-shell-switch-to-shell):
Redisplay the switched-to window faster (bug#47679).
Copyright-paperwork-exempt: yes
2021-04-12 10:43:42 +02:00
Stefan Kangas
4a538c4861
Remove redundant #' before lambda in progmodes/*.el
...
* 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.
2021-04-01 16:26:44 +02:00
Lars Ingebrigtsen
eb9f80e37b
Revert "Do interactive mode tagging for python.el navigation functions."
...
This reverts commit 546f552e7b
.
This is a "core package", so can't use the new syntax.
2021-02-18 12:52:55 +01:00
Doug Davis
546f552e7b
Do interactive mode tagging for python.el navigation functions.
...
* lisp/progmodes/python.el (navigation functions): Add python-mode to
`interactive' declarations for mode-specific commands (bug#46610).
Copyright-paperwork-exempt: yes
2021-02-18 12:40:23 +01:00
Lars Ingebrigtsen
3bf21f52b6
Deactivate region in `C-c C-r' in python-mode
...
* lisp/progmodes/python.el (python-shell-send-region): Deactivate
mark after executing (bug#28789). This is how this command worked
in Emacs 24, apparently.
2021-02-04 18:24:34 +01:00
Glenn Morris
fa686f0998
Default python-shell-interpreter to python3
...
* lisp/progmodes/python.el (python-shell-interpreter): Default to
python3 (bug#45655).
2021-01-10 15:48:57 +01:00
Paul Eggert
ba05d005e5
Update copyright year to 2021
...
Run "TZ=UTC0 admin/update-copyright".
2021-01-01 01:13:56 -08:00
Dario Gjorgjevski
b2ce94fa5e
Make python-mode fontify more assignment statements
...
* 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).
2020-12-21 05:41:07 +01:00
Tomas Nordin
8b3de06347
Fix narrow-to-defun in python-mode
...
* lisp/progmodes/python.el (python-nav--beginning-of-defun): Make
narrow-to-defun work better in classes (bug#40563).
Copyright-paperwork-exempt: yes
2020-12-14 16:58:07 +01:00
Stefan Kangas
f22e4bbf1c
Prefer setq-local in python.el
...
* 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.
2020-12-12 13:27:35 +01:00
Stefan Kangas
af2695b045
* lisp/progmodes/python.el: Bump version.
2020-12-11 16:16:36 +01:00
Lars Ingebrigtsen
3e6eccc175
Recompute error positions in python-shell-send-region
...
* lisp/progmodes/python.el (python-shell-send-region): Recompute
line positions when evaluating (bug#22934).
2020-12-03 10:21:19 +01:00
Stefan Kangas
4e94267042
Remove redundant installation instructions
...
* 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.
2020-11-12 03:12:35 +01:00
Dario Gjorgjevski
e7b4f465e8
Fix python-font-lock-keywords-maximum-decoration performance regression
...
* 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).
2020-11-11 12:27:59 +01:00
Dario Gjorgjevski
296e4dd15e
Fix font lock of assignments with type hints in Python
...
* 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.
2020-11-11 10:49:04 +01:00
Lars Ingebrigtsen
0d9e2b80d8
Make the SHOW parameter work again in `run-python'
...
* lisp/progmodes/python.el (run-python): Make the SHOW parameter
work again after the fix for 31398 (bug#44421).
2020-11-09 17:21:56 +01:00
Stefan Monnier
a63d905175
Fix misuses of make-local-variable
on hooks
...
* 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.
2020-11-04 00:24:45 -05:00
Lars Ingebrigtsen
0d8c6df6c1
Tweak previous python-mode region fix
...
* lisp/progmodes/python.el (python-shell-buffer-substring): Tweak
the previous fix for bug#39398 to behave somewhat more like it
used to.
2020-10-30 16:15:42 +01:00
Lars Ingebrigtsen
8c8349e4b5
Tweak how `C-c C-r' computes the region in python-mode
...
* lisp/progmodes/python.el (python-shell-buffer-substring): Don't
extend the region to the start of the line (bug#39398), but allow
sending the actual region as marked.
2020-10-27 20:29:08 +01:00
Stefan Kangas
dd16e46bb9
; Prefer https to http in more URLs
...
These were all tested and confirmed working.
2020-10-24 20:23:27 +02:00
Stefan Monnier
f831fa1744
* lisp/progmodes/python.el: Bump version to release the f-string support
2020-10-19 13:39:42 -04:00
Stefan Monnier
3b3274a85c
* lisp/progmodes/python.el: Teach f-strings to font-lock
...
(python--f-string-p, python--font-lock-f-strings): New functions.
(python-font-lock-keywords-maximum-decoration): Use them.
2020-10-16 14:03:59 -04:00
Glenn Morris
726eb835dd
Merge from origin/emacs-27
...
78eacf31e8
; Fix many typos in symbols in docs and comments
d5d12707d6
* doc/misc/flymake.texi (Using Flymake): Fix a typo. (Bug...
# Conflicts:
# lisp/allout.el
# lisp/progmodes/ebrowse.el
2020-10-02 09:38:24 -07:00
Stefan Kangas
78eacf31e8
; Fix many typos in symbols in docs and comments
2020-10-02 13:29:45 +02:00
Lars Ingebrigtsen
3f5f3dd604
Make `C-c C-e' in Python buffers work
...
* lisp/progmodes/python.el (python-shell-send-statement): Don't
send a cookie, because that leads to the naked expression not
being evaled (bug#43450).
(python-shell-send-region): Allow not sending a cookie.
(python-shell-buffer-substring): Ditto.
2020-10-02 05:30:37 +02:00
Per Starbäck
aac3effb8f
python-shell-send-defun doesn't find the (whole) definition
...
* lisp/progmodes/python.el (python-shell-send-defun): Fix C-M-x
for definitions like @property\ndef bar(): (bug#37828).
2020-10-02 05:11:06 +02:00
Lars Ingebrigtsen
bf1b3714cc
Fix the defcustom type fix in python.el
...
* lisp/progmodes/python.el (python-pdbtrack-exit-command): Fix
defcustom type (bug#30990).
2020-09-25 15:17:36 +02:00
Lars Ingebrigtsen
e1c33e29d5
Fix some defcustom types
...
* lisp/whitespace.el (whitespace-style):
* lisp/gnus/message.el (message-screenshot-command):
* lisp/progmodes/compile.el (compilation-transform-file-match-alist):
* lisp/progmodes/gdb-mi.el (gdb-default-window-configuration-file):
* lisp/progmodes/python.el (python-pdbtrack-exit-command): Fix the
defcustom types.
* lisp/progmodes/sql.el (sql-password-wallet): Fix the value.
2020-09-25 15:15:21 +02:00
Stefan Kangas
462dbc1cb2
; Fix typos
2020-09-21 14:26:42 +02:00
Noam Postavsky
a68a0e69da
Fix slow python-mode inserts when there's a lot of strings
...
* lisp/progmodes/python.el (python-info-docstring-p): Doing more
than two repetitions here doesn't improve indentation (bug#39598).
2020-09-20 10:46:16 +02:00
Lars Ingebrigtsen
7d927fa8dd
Use `format-prompt' when prompting with default values
...
* lisp/woman.el (woman-file-name):
* lisp/wid-edit.el (widget-file-prompt-value)
(widget-coding-system-prompt-value):
* lisp/w32-fns.el (w32-set-system-coding-system):
* lisp/vc/vc.el (vc-print-root-log):
* lisp/vc/vc-annotate.el (vc-annotate):
* lisp/vc/emerge.el (emerge-read-file-name):
* lisp/vc/ediff.el (ediff-directories)
(ediff-directory-revisions, ediff-directories3)
(ediff-merge-directories, )
(ediff-merge-directories-with-ancestor)
(ediff-merge-directory-revisions)
(ediff-merge-directory-revisions-with-ancestor)
(ediff-merge-revisions, ediff-merge-revisions-with-ancestor)
(ediff-revision):
* lisp/vc/ediff-util.el (ediff-toggle-regexp-match):
* lisp/vc/ediff-mult.el (ediff-filegroup-action):
* lisp/vc/add-log.el (prompt-for-change-log-name):
* lisp/textmodes/table.el (table-insert-row-column)
(table-span-cell, table-split-cell-horizontally)
(table-split-cell, table-justify, table-generate-source)
(table-insert-sequence, table-capture)
(table--read-from-minibuffer, table--query-justification):
* lisp/textmodes/sgml-mode.el (sgml-tag, sgml-tag-help):
* lisp/textmodes/reftex-ref.el (reftex-goto-label):
* lisp/textmodes/refer.el (refer-get-bib-files):
* lisp/textmodes/css-mode.el (css-lookup-symbol):
* lisp/term.el (serial-read-name, serial-read-speed):
* lisp/speedbar.el (speedbar-change-initial-expansion-list):
* lisp/simple.el (previous-matching-history-element)
(set-variable):
* lisp/ses.el (ses-read-cell, ses-set-column-width):
* lisp/replace.el (query-replace-read-from)
(occur-read-primary-args):
* lisp/rect.el (string-rectangle, string-insert-rectangle):
* lisp/progmodes/tcl.el (tcl-help-on-word):
* lisp/progmodes/sh-script.el (sh-set-shell):
* lisp/progmodes/python.el (python-eldoc-at-point):
* lisp/progmodes/octave.el (octave-completing-read)
(octave-update-function-file-comment, octave-insert-defun):
* lisp/progmodes/inf-lisp.el (lisp-symprompt):
* lisp/progmodes/cperl-mode.el (cperl-info-on-command)
(cperl-perldoc):
* lisp/progmodes/compile.el (compilation-find-file):
* lisp/net/rcirc.el (rcirc-prompt-for-encryption):
* lisp/net/eww.el (eww):
* lisp/net/browse-url.el (browse-url-with-browser-kind):
* lisp/man.el (man):
* lisp/mail/sendmail.el (sendmail-query-user-about-smtp):
* lisp/mail/mailalias.el (build-mail-aliases):
* lisp/mail/mailabbrev.el (merge-mail-abbrevs)
(rebuild-mail-abbrevs):
* lisp/locate.el (locate-prompt-for-search-string):
* lisp/isearch.el (isearch-occur):
* lisp/international/ogonek.el (ogonek-read-encoding)
(ogonek-read-prefix):
* lisp/international/mule.el (read-buffer-file-coding-system)
(set-terminal-coding-system, set-keyboard-coding-system)
(set-next-selection-coding-system, recode-region):
* lisp/international/mule-cmds.el ()
(universal-coding-system-argument, search-unencodable-char)
(select-safe-coding-system-interactively):
* lisp/info.el (Info-search, Info-search-backward, Info-menu):
* lisp/info-look.el (info-lookup-interactive-arguments):
* lisp/imenu.el (imenu--completion-buffer):
* lisp/ibuf-ext.el (mode, used-mode, ibuffer-mark-by-mode):
* lisp/hi-lock.el (hi-lock-unface-buffer)
(hi-lock-read-face-name):
* lisp/help.el (view-emacs-news, where-is):
* lisp/help-fns.el (describe-variable, describe-symbol)
(describe-keymap):
* lisp/gnus/mm-decode.el (mm-save-part):
* lisp/gnus/gnus-sum.el (gnus-summary-browse-url):
* lisp/gnus/gnus-group.el (gnus-group--read-bug-ids)
(gnus-group-set-current-level):
* lisp/frame.el (make-frame-on-monitor)
(close-display-connection, select-frame-by-name):
* lisp/format.el (format-encode-buffer, format-encode-region):
* lisp/files.el (recode-file-name):
* lisp/files-x.el (read-file-local-variable)
(read-file-local-variable-value, )
(read-file-local-variable-mode):
* lisp/ffap.el (ffap-menu-ask):
* lisp/faces.el (face-read-string):
* lisp/facemenu.el (facemenu-set-charset):
* lisp/erc/erc-dcc.el (erc-dcc-do-GET-command):
* lisp/emulation/edt-mapper.el (edt-mapper):
* lisp/emacs-lisp/trace.el (trace--read-args)
(trace-function-foreground, trace-function-background):
* lisp/emacs-lisp/smie.el (smie-config-set-indent):
* lisp/emacs-lisp/re-builder.el (reb-change-syntax):
* lisp/emacs-lisp/package.el (describe-package):
* lisp/emacs-lisp/find-func.el (read-library-name)
(find-function-read):
* lisp/emacs-lisp/ert.el (ert-read-test-name)
(ert-run-tests-interactively):
* lisp/emacs-lisp/disass.el (disassemble):
* lisp/emacs-lisp/debug.el (debug-on-entry)
(debug-on-variable-change):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-read-regexp):
* lisp/dired-x.el (dired--mark-suffix-interactive-spec):
* lisp/dired-aux.el (dired-diff):
* lisp/cus-edit.el (custom-variable-prompt, customize-mode)
(customize-changed-options):
* lisp/completion.el (interactive-completion-string-reader):
* lisp/calendar/timeclock.el (timeclock-ask-for-project):
* lisp/calc/calcalg3.el (calc-get-fit-variables):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-bin.el (calc-word-size):
* lisp/bookmark.el (bookmark-set-internal):
* lisp/abbrev.el (read-abbrev-file): Use `format-prompt' for
prompting (bug#12443).
2020-09-06 16:56:54 +02:00
Carlos Pita
c570a79a77
Don't override python font locking in comint
...
* lisp/comint.el (comint-highlight-input): New variable (bug#32344).
(comint-send-input): Use it.
* lisp/progmodes/python.el (inferior-python-mode): Set it.
2020-08-19 13:13:46 +02:00
Lars Ingebrigtsen
033f98efc3
Remove some compat code from python.el
...
* lisp/progmodes/python.el: Remove some compat function definitions.
2020-08-18 12:02:58 +02:00
Lars Ingebrigtsen
f1e2d366e5
Revert "Indent python multiline strings to start and previous levels"
...
This reverts commit b78583cde7
.
The multi-line string indentation was incorrect after applying this patch.
2020-08-09 23:51:24 +02:00
Carlos Pita
b78583cde7
Indent python multiline strings to start and previous levels
...
* progmodes/python.el (python-indent--calculate-indentation): Add an
additional indentation point to match indentation of previous line in
a multiline string. Then Tab iterates between 0, the start indentation
level and the previous line level (bug#37726).
2020-08-09 20:44:55 +02:00
Glenn Morris
398a268061
Merge from origin/emacs-27
...
c04b92104c
Add commentary in gtkutil.c
6290850dac
Consistently stylize eldoc as ElDoc in prose
136e931189
Improve documentation of "C-u C-x ="
1f52771fd3
Mention floating rounding issues
c892ae65b4
Repair global-auto-revert-ignore-modes (bug#42271)
3a446a02fb
; * src/xdisp.c (decode_mode_spec): Fix commentary.
79f381b4a6
One more improvement of left/right-fringe display spec docs
1279bdb072
Another clarification of left/right-fringe display spec
# Conflicts:
# doc/emacs/programs.texi
2020-07-11 09:25:04 -07:00
Basil L. Contovounesios
6290850dac
Consistently stylize eldoc as ElDoc in prose
...
* doc/emacs/custom.texi (Specifying File Variables):
* doc/emacs/modes.texi (Major Modes):
* doc/emacs/programs.texi (Lisp Doc):
* etc/NEWS.22:
* etc/NEWS.23:
* lisp/progmodes/python.el:
(python-eldoc-function):
* test/lisp/progmodes/python-tests.el: Consistently capitalize eldoc
as ElDoc rather than Eldoc.
2020-07-10 15:22:27 +01:00
João Távora
6063b542f7
Shoosh warnings about obsolete eldoc-documentation-function
...
* lisp/progmodes/cfengine.el (cfengine3-mode): Remove mention to
obsolete eldoc-documentation-function.
* lisp/progmodes/python.el (python-mode): Use with-no-warnings.
2020-07-08 20:20:19 +01:00