Subject: Re: 25.3; python-shell-send-defun sends only one line

From: David Liu <[email-masked]>
Date: Wed, 14 Mar 2018 16:37:30 -0400

regarding the possible bug with python-shell-send-defun, it seems to *only*
occurs if the python function starts on the very first line of the file.
Otherwise, python-shell-send-defun works perfectly.

On Wed, Mar 14, 2018 at 4:05 PM, David Liu <[email-masked]> wrote:

> note: no other Python-related emacs packages are being used;
> only the builtin one.
>
> 1. create new file "test.py" with following:
>
> def f(x):
>     return x+1
>
> 2. C-c C-p to run-python
>
> 3. place point immediately after "return x+1"
>
> 4. C-M-x for python-shell-send-defun
>
> result:
>
>     SyntaxError: 'return' outside function
>
> it appears that only one line is being sent, instead of both lines.
>
>
>
> In GNU Emacs 25.3.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version
> 10.9.5 (Build 13F1911))
>  of 2017-09-12 built on builder10-9.local
> Windowing system distributor 'Apple', version 10.3.1561
> Configured using:
>  'configure --with-ns '--enable-locallisppath=/Library/Application
>  Support/Emacs/${version}/site-lisp:/Library/Application
>  Support/Emacs/site-lisp' --with-modules'
>
> Configured features:
> NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES
>
> Important settings:
>   value of $LANG: en_US.UTF-8
>   locale-coding-system: utf-8-unix
>
> Major mode: Python
>
> Minor modes in effect:
>   shell-dirtrack-mode: t
>   tooltip-mode: t
>   global-eldoc-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>
> Recent messages:
> uncompressing python.el.gz...done
> Making completion list...
> t
>
> delete-backward-char: Text is read-only
> Quit
>
> <C-tab> is undefined
> mouse-2, RET: find function's definition
> uncompressing python.el.gz...done
>
> Load-path shadows:
> /Users/daveliu/quicklisp/dists/quicklisp/software/slime-v2.20/slime-autoloads
> hides /Users/daveliu/.emacs.d/elpa/slime-20180308.733/slime-autoloads
> /Users/daveliu/quicklisp/dists/quicklisp/software/slime-v2.20/slime-tests
> hides /Users/daveliu/.emacs.d/elpa/slime-20180308.733/slime-tests
> /Users/daveliu/quicklisp/dists/quicklisp/software/slime-v2.20/slime hides
> /Users/daveliu/.emacs.d/elpa/slime-20180308.733/slime
>
> Features:
> (shadow sort mail-extr emacsbug message dired rfc822 mml mml-sec epg
> mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
> mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils jka-compr
> eieio-opt speedbar sb-image ezimage dframe find-func tramp-cache python
> tramp-sh tramp tramp-compat auth-source gnus-util mm-util help-fns
> mail-prsvr password-cache tramp-loaddefs trampver shell pcomplete
> format-spec json map slime-fancy slime-trace-dialog slime-fontifying-fu
> slime-package-fu slime-references slime-compiler-notes-tree
> slime-scratch slime-presentations advice bridge slime-macrostep
> macrostep slime-mdot-fu slime-enclosing-context slime-fuzzy
> slime-fancy-trace slime-fancy-inspector slime-c-p-c
> slime-editing-commands slime-autodoc slime-repl elp slime-parse slime
> derived edmacro kmacro lisp-mnt gud apropos compile etags xref cl-seq
> project eieio eieio-core arc-mode archive-mode noutline outline
> easy-mmode pp comint ansi-color ring hyperspec cl-macs thingatpt
> browse-url cl tango-dark-theme finder-inf tex-site info slime-autoloads
> package epg-config seq byte-opt gv bytecomp byte-compile cl-extra
> help-mode easymenu cconv cl-loaddefs pcase cl-lib time-date mule-util
> tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
> mwheel ns-win ucs-normalize term/common-win tool-bar dnd fontset image
> regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode
> prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
> mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham
> georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
> korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
> european ethiopic indian cyrillic chinese charscript case-table epa-hook
> jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
> loaddefs button faces cus-face macroexp files text-properties overlay
> sha1 md5 base64 format env code-pages mule custom widget
> hashtable-print-readable backquote kqueue cocoa ns multi-tty
> make-network-process emacs)
>
> Memory information:
> ((conses 16 337784 17797)
>  (symbols 48 30156 0)
>  (miscs 40 149 592)
>  (strings 32 48025 8240)
>  (string-bytes 1 1429236)
>  (vectors 16 43362)
>  (vector-slots 8 786245 7866)
>  (floats 8 339 383)
>  (intervals 56 649 397)
>  (buffers 976 27))
>
>