* bug#42513: Python indentation bug when using multi-line on an if-condition
@ 2020-07-24 9:40 swedebugia
2020-09-15 23:25 ` bug#42513: Possible fix for Python indentation problem Dale Sedivec
2021-01-27 6:47 ` bug#42513: Python indentation bug when using multi-line on an if-condition Lars Ingebrigtsen
0 siblings, 2 replies; 5+ messages in thread
From: swedebugia @ 2020-07-24 9:40 UTC (permalink / raw)
To: 42513
Hi
The following code indents correctly:
def fun(arg):
if(
args.suppliername == "x"):
#do something
else:
#do something
The following code does not indent correctly:
def fun(arg):
if(
args.suppliername == "Messingschlager" or
args.suppliercodename == "MS"
): #<- culprit
#do something
else: #<- this else is not possible to indent 1 tab
#do something
In GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
of 2020-05-19 built on felixonmars2
Configured using:
'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
--localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-wide-int
--with-modules 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt'
CPPFLAGS=-D_FORTIFY_SOURCE=2
LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB
NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD LCMS2
Important settings:
value of $LANG: sv_SE.utf8
locale-coding-system: utf-8-unix
Major mode: Python
Minor modes in effect:
diff-auto-refine-mode: t
shell-dirtrack-mode: t
show-paren-mode: t
electric-pair-mode: t
savehist-mode: t
fci-mode: t
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
/home/user/.emacs.d/elpa/org-20180402/ob-R hides /usr/share/emacs/26.3/lisp/org/ob-R
/home/user/.emacs.d/elpa/org-20180402/ob-lob hides /usr/share/emacs/26.3/lisp/org/ob-lob
/home/user/.emacs.d/elpa/org-20180402/org-src hides /usr/share/emacs/26.3/lisp/org/org-src
/home/user/.emacs.d/elpa/org-20180402/org-protocol hides /usr/share/emacs/26.3/lisp/org/org-protocol
/home/user/.emacs.d/elpa/org-20180402/org-macro hides /usr/share/emacs/26.3/lisp/org/org-macro
/home/user/.emacs.d/elpa/org-20180402/ob-matlab hides /usr/share/emacs/26.3/lisp/org/ob-matlab
/home/user/.emacs.d/elpa/org-20180402/ox-texinfo hides /usr/share/emacs/26.3/lisp/org/ox-texinfo
/home/user/.emacs.d/elpa/org-20180402/ob-io hides /usr/share/emacs/26.3/lisp/org/ob-io
/home/user/.emacs.d/elpa/org-20180402/org-agenda hides /usr/share/emacs/26.3/lisp/org/org-agenda
/home/user/.emacs.d/elpa/org-20180402/org-faces hides /usr/share/emacs/26.3/lisp/org/org-faces
/home/user/.emacs.d/elpa/org-20180402/org-attach hides /usr/share/emacs/26.3/lisp/org/org-attach
/home/user/.emacs.d/elpa/org-20180402/org-inlinetask hides /usr/share/emacs/26.3/lisp/org/org-inlinetask
/home/user/.emacs.d/elpa/org-20180402/ob-sqlite hides /usr/share/emacs/26.3/lisp/org/ob-sqlite
/home/user/.emacs.d/elpa/org-20180402/ox-html hides /usr/share/emacs/26.3/lisp/org/ox-html
/home/user/.emacs.d/elpa/org-20180402/ob-ruby hides /usr/share/emacs/26.3/lisp/org/ob-ruby
/home/user/.emacs.d/elpa/org-20180402/ob-perl hides /usr/share/emacs/26.3/lisp/org/ob-perl
/home/user/.emacs.d/elpa/org-20180402/org-table hides /usr/share/emacs/26.3/lisp/org/org-table
/home/user/.emacs.d/elpa/org-20180402/ox-ascii hides /usr/share/emacs/26.3/lisp/org/ox-ascii
/home/user/.emacs.d/elpa/org-20180402/ob-sed hides /usr/share/emacs/26.3/lisp/org/ob-sed
/home/user/.emacs.d/elpa/org-20180402/org-crypt hides /usr/share/emacs/26.3/lisp/org/org-crypt
/home/user/.emacs.d/elpa/org-20180402/org-rmail hides /usr/share/emacs/26.3/lisp/org/org-rmail
/home/user/.emacs.d/elpa/org-20180402/ob-js hides /usr/share/emacs/26.3/lisp/org/ob-js
/home/user/.emacs.d/elpa/org-20180402/ob-processing hides /usr/share/emacs/26.3/lisp/org/ob-processing
/home/user/.emacs.d/elpa/org-20180402/ob-picolisp hides /usr/share/emacs/26.3/lisp/org/ob-picolisp
/home/user/.emacs.d/elpa/org-20180402/org-eww hides /usr/share/emacs/26.3/lisp/org/org-eww
/home/user/.emacs.d/elpa/org-20180402/org-list hides /usr/share/emacs/26.3/lisp/org/org-list
/home/user/.emacs.d/elpa/org-20180402/org-archive hides /usr/share/emacs/26.3/lisp/org/org-archive
/home/user/.emacs.d/elpa/org-20180402/org-indent hides /usr/share/emacs/26.3/lisp/org/org-indent
/home/user/.emacs.d/elpa/org-20180402/ob-stan hides /usr/share/emacs/26.3/lisp/org/ob-stan
/home/user/.emacs.d/elpa/org-20180402/ob-makefile hides /usr/share/emacs/26.3/lisp/org/ob-makefile
/home/user/.emacs.d/elpa/org-20180402/ob-lua hides /usr/share/emacs/26.3/lisp/org/ob-lua
/home/user/.emacs.d/elpa/org-20180402/ox-md hides /usr/share/emacs/26.3/lisp/org/ox-md
/home/user/.emacs.d/elpa/org-20180402/ob-ref hides /usr/share/emacs/26.3/lisp/org/ob-ref
/home/user/.emacs.d/elpa/org-20180402/ob-clojure hides /usr/share/emacs/26.3/lisp/org/ob-clojure
/home/user/.emacs.d/elpa/org-20180402/org-version hides /usr/share/emacs/26.3/lisp/org/org-version
/home/user/.emacs.d/elpa/org-20180402/ox-beamer hides /usr/share/emacs/26.3/lisp/org/ox-beamer
/home/user/.emacs.d/elpa/org-20180402/ob-ebnf hides /usr/share/emacs/26.3/lisp/org/ob-ebnf
/home/user/.emacs.d/elpa/org-20180402/ob-plantuml hides /usr/share/emacs/26.3/lisp/org/ob-plantuml
/home/user/.emacs.d/elpa/org-20180402/ob-dot hides /usr/share/emacs/26.3/lisp/org/ob-dot
/home/user/.emacs.d/elpa/org-20180402/ob-haskell hides /usr/share/emacs/26.3/lisp/org/ob-haskell
/home/user/.emacs.d/elpa/org-20180402/ob-hledger hides /usr/share/emacs/26.3/lisp/org/ob-hledger
/home/user/.emacs.d/elpa/org-20180402/ob-lisp hides /usr/share/emacs/26.3/lisp/org/ob-lisp
/home/user/.emacs.d/elpa/org-20180402/org-mhe hides /usr/share/emacs/26.3/lisp/org/org-mhe
/home/user/.emacs.d/elpa/org-20180402/org-element hides /usr/share/emacs/26.3/lisp/org/org-element
/home/user/.emacs.d/elpa/org-20180402/org-compat hides /usr/share/emacs/26.3/lisp/org/org-compat
/home/user/.emacs.d/elpa/org-20180402/ob-ditaa hides /usr/share/emacs/26.3/lisp/org/ob-ditaa
/home/user/.emacs.d/elpa/org-20180402/org-w3m hides /usr/share/emacs/26.3/lisp/org/org-w3m
/home/user/.emacs.d/elpa/org-20180402/ob-abc hides /usr/share/emacs/26.3/lisp/org/ob-abc
/home/user/.emacs.d/elpa/org-20180402/ox hides /usr/share/emacs/26.3/lisp/org/ox
/home/user/.emacs.d/elpa/org-20180402/org-bibtex hides /usr/share/emacs/26.3/lisp/org/org-bibtex
/home/user/.emacs.d/elpa/org-20180402/org-bbdb hides /usr/share/emacs/26.3/lisp/org/org-bbdb
/home/user/.emacs.d/elpa/org-20180402/ob-sass hides /usr/share/emacs/26.3/lisp/org/ob-sass
/home/user/.emacs.d/elpa/org-20180402/ox-man hides /usr/share/emacs/26.3/lisp/org/ox-man
/home/user/.emacs.d/elpa/org-20180402/ob-emacs-lisp hides /usr/share/emacs/26.3/lisp/org/ob-emacs-lisp
/home/user/.emacs.d/elpa/org-20180402/ob hides /usr/share/emacs/26.3/lisp/org/ob
/home/user/.emacs.d/elpa/org-20180402/ob-J hides /usr/share/emacs/26.3/lisp/org/ob-J
/home/user/.emacs.d/elpa/org-20180402/ox-org hides /usr/share/emacs/26.3/lisp/org/ox-org
/home/user/.emacs.d/elpa/org-20180402/ob-java hides /usr/share/emacs/26.3/lisp/org/ob-java
/home/user/.emacs.d/elpa/org-20180402/ob-groovy hides /usr/share/emacs/26.3/lisp/org/ob-groovy
/home/user/.emacs.d/elpa/org-20180402/ob-fortran hides /usr/share/emacs/26.3/lisp/org/ob-fortran
/home/user/.emacs.d/elpa/org-20180402/ox-latex hides /usr/share/emacs/26.3/lisp/org/ox-latex
/home/user/.emacs.d/elpa/org-20180402/org-gnus hides /usr/share/emacs/26.3/lisp/org/org-gnus
/home/user/.emacs.d/elpa/org-20180402/ob-ledger hides /usr/share/emacs/26.3/lisp/org/ob-ledger
/home/user/.emacs.d/elpa/org-20180402/ob-table hides /usr/share/emacs/26.3/lisp/org/ob-table
/home/user/.emacs.d/elpa/org-20180402/ob-tangle hides /usr/share/emacs/26.3/lisp/org/ob-tangle
/home/user/.emacs.d/elpa/org-20180402/ob-coq hides /usr/share/emacs/26.3/lisp/org/ob-coq
/home/user/.emacs.d/elpa/org-20180402/ox-icalendar hides /usr/share/emacs/26.3/lisp/org/ox-icalendar
/home/user/.emacs.d/elpa/org-20180402/ob-asymptote hides /usr/share/emacs/26.3/lisp/org/ob-asymptote
/home/user/.emacs.d/elpa/org-20180402/org-eshell hides /usr/share/emacs/26.3/lisp/org/org-eshell
/home/user/.emacs.d/elpa/org-20180402/ob-maxima hides /usr/share/emacs/26.3/lisp/org/ob-maxima
/home/user/.emacs.d/elpa/org-20180402/ob-shen hides /usr/share/emacs/26.3/lisp/org/ob-shen
/home/user/.emacs.d/elpa/org-20180402/org-colview hides /usr/share/emacs/26.3/lisp/org/org-colview
/home/user/.emacs.d/elpa/org-20180402/ob-sql hides /usr/share/emacs/26.3/lisp/org/ob-sql
/home/user/.emacs.d/elpa/org-20180402/ob-core hides /usr/share/emacs/26.3/lisp/org/ob-core
/home/user/.emacs.d/elpa/org-20180402/ob-octave hides /usr/share/emacs/26.3/lisp/org/ob-octave
/home/user/.emacs.d/elpa/org-20180402/org-entities hides /usr/share/emacs/26.3/lisp/org/org-entities
/home/user/.emacs.d/elpa/org-20180402/org-install hides /usr/share/emacs/26.3/lisp/org/org-install
/home/user/.emacs.d/elpa/org-20180402/org-lint hides /usr/share/emacs/26.3/lisp/org/org-lint
/home/user/.emacs.d/elpa/org-20180402/ob-exp hides /usr/share/emacs/26.3/lisp/org/ob-exp
/home/user/.emacs.d/elpa/org-20180402/ob-shell hides /usr/share/emacs/26.3/lisp/org/ob-shell
/home/user/.emacs.d/elpa/org-20180402/ob-python hides /usr/share/emacs/26.3/lisp/org/ob-python
/home/user/.emacs.d/elpa/org-20180402/org-feed hides /usr/share/emacs/26.3/lisp/org/org-feed
/home/user/.emacs.d/elpa/org-20180402/ob-screen hides /usr/share/emacs/26.3/lisp/org/ob-screen
/home/user/.emacs.d/elpa/org-20180402/ob-keys hides /usr/share/emacs/26.3/lisp/org/ob-keys
/home/user/.emacs.d/elpa/org-20180402/ox-odt hides /usr/share/emacs/26.3/lisp/org/ox-odt
/home/user/.emacs.d/elpa/org-20180402/ob-calc hides /usr/share/emacs/26.3/lisp/org/ob-calc
/home/user/.emacs.d/elpa/org-20180402/org-macs hides /usr/share/emacs/26.3/lisp/org/org-macs
/home/user/.emacs.d/elpa/org-20180402/org-datetree hides /usr/share/emacs/26.3/lisp/org/org-datetree
/home/user/.emacs.d/elpa/org-20180402/ob-eval hides /usr/share/emacs/26.3/lisp/org/ob-eval
/home/user/.emacs.d/elpa/org-20180402/org-timer hides /usr/share/emacs/26.3/lisp/org/org-timer
/home/user/.emacs.d/elpa/org-20180402/org-plot hides /usr/share/emacs/26.3/lisp/org/org-plot
/home/user/.emacs.d/elpa/org-20180402/ob-latex hides /usr/share/emacs/26.3/lisp/org/ob-latex
/home/user/.emacs.d/elpa/org-20180402/org hides /usr/share/emacs/26.3/lisp/org/org
/home/user/.emacs.d/elpa/org-20180402/ob-forth hides /usr/share/emacs/26.3/lisp/org/ob-forth
/home/user/.emacs.d/elpa/org-20180402/org-habit hides /usr/share/emacs/26.3/lisp/org/org-habit
/home/user/.emacs.d/elpa/org-20180402/org-mouse hides /usr/share/emacs/26.3/lisp/org/org-mouse
/home/user/.emacs.d/elpa/org-20180402/ob-vala hides /usr/share/emacs/26.3/lisp/org/ob-vala
/home/user/.emacs.d/elpa/org-20180402/ob-scheme hides /usr/share/emacs/26.3/lisp/org/ob-scheme
/home/user/.emacs.d/elpa/org-20180402/ob-css hides /usr/share/emacs/26.3/lisp/org/ob-css
/home/user/.emacs.d/elpa/org-20180402/org-clock hides /usr/share/emacs/26.3/lisp/org/org-clock
/home/user/.emacs.d/elpa/org-20180402/ob-gnuplot hides /usr/share/emacs/26.3/lisp/org/ob-gnuplot
/home/user/.emacs.d/elpa/org-20180402/ob-ocaml hides /usr/share/emacs/26.3/lisp/org/ob-ocaml
/home/user/.emacs.d/elpa/org-20180402/ob-comint hides /usr/share/emacs/26.3/lisp/org/ob-comint
/home/user/.emacs.d/elpa/org-20180402/org-loaddefs hides /usr/share/emacs/26.3/lisp/org/org-loaddefs
/home/user/.emacs.d/elpa/org-20180402/org-irc hides /usr/share/emacs/26.3/lisp/org/org-irc
/home/user/.emacs.d/elpa/org-20180402/ob-lilypond hides /usr/share/emacs/26.3/lisp/org/ob-lilypond
/home/user/.emacs.d/elpa/org-20180402/org-capture hides /usr/share/emacs/26.3/lisp/org/org-capture
/home/user/.emacs.d/elpa/org-20180402/org-duration hides /usr/share/emacs/26.3/lisp/org/org-duration
/home/user/.emacs.d/elpa/org-20180402/org-pcomplete hides /usr/share/emacs/26.3/lisp/org/org-pcomplete
/home/user/.emacs.d/elpa/org-20180402/org-id hides /usr/share/emacs/26.3/lisp/org/org-id
/home/user/.emacs.d/elpa/org-20180402/ob-org hides /usr/share/emacs/26.3/lisp/org/ob-org
/home/user/.emacs.d/elpa/org-20180402/org-docview hides /usr/share/emacs/26.3/lisp/org/org-docview
/home/user/.emacs.d/elpa/org-20180402/org-info hides /usr/share/emacs/26.3/lisp/org/org-info
/home/user/.emacs.d/elpa/org-20180402/ob-mscgen hides /usr/share/emacs/26.3/lisp/org/ob-mscgen
/home/user/.emacs.d/elpa/org-20180402/ob-C hides /usr/share/emacs/26.3/lisp/org/ob-C
/home/user/.emacs.d/elpa/org-20180402/ob-awk hides /usr/share/emacs/26.3/lisp/org/ob-awk
/home/user/.emacs.d/elpa/org-20180402/org-footnote hides /usr/share/emacs/26.3/lisp/org/org-footnote
/home/user/.emacs.d/elpa/org-20180402/org-mobile hides /usr/share/emacs/26.3/lisp/org/org-mobile
/home/user/.emacs.d/elpa/org-20180402/ox-publish hides /usr/share/emacs/26.3/lisp/org/ox-publish
/home/user/.emacs.d/elpa/org-20180402/org-ctags hides /usr/share/emacs/26.3/lisp/org/org-ctags
Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils cl-extra cl-print debug tango-dark-theme manoj-dark-theme
cus-theme misearch multi-isearch pp thingatpt help-fns radix-tree
help-mode cus-edit wid-edit vc-git diff-mode easy-mmode disp-table
python tramp-sh tramp tramp-compat tramp-loaddefs trampver ucs-normalize
shell pcomplete parse-time format-spec advice json map comint ring
ansi-color term/xterm xterm time-date light-blue-theme paren elec-pair
cus-start cus-load savehist windmove fill-column-indicator edmacro
kmacro multi-line multi-line-find multi-line-enter multi-line-decorator
multi-line-respace multi-line-shared s dash shut-up multi-line-cycle
multi-line-candidate eieio-compat finder-inf info package easymenu
epg-config url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors 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 composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray 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 threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)
Memory information:
((conses 16 373621 25184)
(symbols 48 30678 1)
(miscs 40 514 1609)
(strings 32 77249 2576)
(string-bytes 1 2107931)
(vectors 16 52116)
(vector-slots 8 1611913 175258)
(floats 8 115 1567)
(intervals 56 3981 0)
(buffers 992 17))
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#42513: Possible fix for Python indentation problem
2020-07-24 9:40 bug#42513: Python indentation bug when using multi-line on an if-condition swedebugia
@ 2020-09-15 23:25 ` Dale Sedivec
2021-01-27 6:47 ` bug#42513: Python indentation bug when using multi-line on an if-condition Lars Ingebrigtsen
1 sibling, 0 replies; 5+ messages in thread
From: Dale Sedivec @ 2020-09-15 23:25 UTC (permalink / raw)
To: 42513
FYI I'm testing this fix against master:
diff --git a/python.el b/python.el
index b36a583..24f5f87 100644
--- a/python.el
+++ b/python.el
@@ -4991,6 +4991,7 @@ likely an invalid python file."
;; block and the current line, otherwise it
;; is not an opening block.
(save-excursion
+ (python-nav-end-of-statement)
(forward-line)
(let ((no-back-indent t))
(save-match-data
(https://github.com/dsedivec/python/commit/7d2a97ca995c4a6673fa68861e42c54c9e8f6596.diff if my MUA mangles that.)
All this does is move to the end of the block opener (e.g. the "if" statement) before moving to the next line, where it expects to be within the "if"s block.
Dale
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#42513: Python indentation bug when using multi-line on an if-condition
2020-07-24 9:40 bug#42513: Python indentation bug when using multi-line on an if-condition swedebugia
2020-09-15 23:25 ` bug#42513: Possible fix for Python indentation problem Dale Sedivec
@ 2021-01-27 6:47 ` Lars Ingebrigtsen
2021-01-27 18:20 ` Dale Sedivec
1 sibling, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-27 6:47 UTC (permalink / raw)
To: swedebugia; +Cc: 42513, Dale Sedivec
[-- Attachment #1: Type: text/plain, Size: 656 bytes --]
swedebugia <swedebugia@riseup.net> writes:
> The following code indents correctly:
> def fun(arg):
> if(
> args.suppliername == "x"):
> #do something
> else:
> #do something
>
> The following code does not indent correctly:
> def fun(arg):
> if(
> args.suppliername == "Messingschlager" or
> args.suppliercodename == "MS"
> ): #<- culprit
> #do something
> else: #<- this else is not possible to indent 1 tab
> #do something
I tried this in Emacs 26.1 and Emacs 28, and both seem to indent the
same, or am I missing something?
[-- Attachment #2: Type: image/png, Size: 87579 bytes --]
[-- Attachment #3: Type: text/plain, Size: 129 bytes --]
Both are wrong, though.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#42513: Python indentation bug when using multi-line on an if-condition
2021-01-27 6:47 ` bug#42513: Python indentation bug when using multi-line on an if-condition Lars Ingebrigtsen
@ 2021-01-27 18:20 ` Dale Sedivec
2021-01-28 4:55 ` Lars Ingebrigtsen
0 siblings, 1 reply; 5+ messages in thread
From: Dale Sedivec @ 2021-01-27 18:20 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: swedebugia, 42513
On Jan 27, 2021, at 00:47, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> swedebugia <swedebugia@riseup.net> writes:
>
>> The following code indents correctly:
>> def fun(arg):
>> if(
>> args.suppliername == "x"):
>> #do something
>> else:
>> #do something
>>
>> The following code does not indent correctly:
>> def fun(arg):
>> if(
>> args.suppliername == "Messingschlager" or
>> args.suppliercodename == "MS"
>> ): #<- culprit
>> #do something
>> else: #<- this else is not possible to indent 1 tab
>> #do something
>
> I tried this in Emacs 26.1 and Emacs 28, and both seem to indent the
> same, or am I missing something?
If I use something other than a comment following the "if" statement line, I can reproduce the original behavior in a master build from yesterday. For example, replace "#do something" with "''" (an empty string) or just "bar".
(I am *guessing* the original reporter's code had at least one statement in the "if" block. It's not valid syntax otherwise.)
Dale
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#42513: Python indentation bug when using multi-line on an if-condition
2021-01-27 18:20 ` Dale Sedivec
@ 2021-01-28 4:55 ` Lars Ingebrigtsen
0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-28 4:55 UTC (permalink / raw)
To: Dale Sedivec; +Cc: swedebugia, 42513
[-- Attachment #1: Type: text/plain, Size: 648 bytes --]
Dale Sedivec <dale@codefu.org> writes:
> If I use something other than a comment following the "if" statement
> line, I can reproduce the original behavior in a master build from
> yesterday. For example, replace "#do something" with "''" (an empty
> string) or just "bar".
Indeed:
def fun(arg):
if(
args.suppliername == "x"):
foo
else:
foo
def fun(arg):
if(
args.suppliername == "Messingschlager" or
args.suppliercodename == "MS"
):
foo
else:
foo
[-- Attachment #2: Type: image/png, Size: 56981 bytes --]
[-- Attachment #3: Type: text/plain, Size: 404 bytes --]
> (I am *guessing* the original reporter's code had at least one
> statement in the "if" block. It's not valid syntax otherwise.)
However, both these examples indent the same for me in Emacs 26.1 and
Emacs 28 (wrong in the same way), so I'm still not seeing what the
original reporter is seeing?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-01-28 4:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-24 9:40 bug#42513: Python indentation bug when using multi-line on an if-condition swedebugia
2020-09-15 23:25 ` bug#42513: Possible fix for Python indentation problem Dale Sedivec
2021-01-27 6:47 ` bug#42513: Python indentation bug when using multi-line on an if-condition Lars Ingebrigtsen
2021-01-27 18:20 ` Dale Sedivec
2021-01-28 4:55 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.