emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: If else blocks inside for loop fail in newest version [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/paul/org-mode/lisp/)]
@ 2018-12-19 10:21 Paul Lodder
  2018-12-20 13:39 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Lodder @ 2018-12-19 10:21 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------
If else blocks inside for loops in python cause IndentationError, it does accept the 'if' and the indented part below the 'if', but from 'else:' onwards the code is not evaluated anymore because of the 'unexpected indent'. I added an example code block in which this error occurs. The list 'odds' only contained even values. 

I fixed it by downgrading to an older release again.

#+BEGIN_SRC python
  even = []
  for i in range(10):
      if i % 2 == 0:
          even.append(i)
      else:
          print("here")
          even.append(("this should be in the list as well",))

  even
#+END_SRC

Emacs  : GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21)
 of 2017-09-22, modified by Debian
Package: Org mode version 9.1.14 (9.1.14-1-g4931fc-elpa @ /home/paul/org-mode/lisp/)

current state:
==============
(setq
 org-src-lang-modes '(("jupyter-python" . python)
                      ("latex-macros" . latex) ("ipython" . python)
                      ("ocaml" . tuareg) ("elisp" . emacs-lisp)
                      ("ditaa" . artist) ("asymptote" . asy)
                      ("dot" . fundamental) ("sqlite" . sql)
                      ("calc" . fundamental) ("C" . c) ("cpp" . c++)
                      ("C++" . c++) ("screen" . shell-script)
                      ("shell" . sh) ("bash" . sh))
 org-journal-mode-hook '(#[nil "\301\b\302\303\304$\207"
                           [org-journal-encrypt-on org-add-hook
                            org-journal-encryption-hook nil t]
                           5]
                         (lambda nil
                          (org-add-hook org-journal-encrypt-on
                           (quote org-journal-encryption-hook) nil t)
                          )
                         )
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
                      org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-activate
                          org-babel-speed-command-activate)
 org-ellipsis "⤵"
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-time-stamp-custom-formats '("<%a %d %B>" . "<%d %b %a %H:%M>")
 org-preview-latex-default-process 'luamagick
 org-file-apps '((auto-mode . emacs) ("\\.mm\\'" . default)
                 ("\\.x?html?\\'" . default) ("pdf" . "mupdf %s")
                 ("docx?" . "loffice %s"))
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-from-is-user-regexp "\\<paul\\>"
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
                     org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(org-clock-load ob-ipython-auto-configure-kernels
                 org-bullets-mode
                 #[0 "\300\301\302\303\304$\207"
                   [add-hook change-major-mode-hook org-show-block-all
                    append local]
                   5]
                 #[0 "\300\301\302\303\304$\207"
                   [add-hook change-major-mode-hook
                    org-babel-show-result-all append local]
                   5]
                 org-babel-result-hide-spec org-babel-hide-all-hashes
                 org-journal-update-auto-mode-alist)
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"]
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-clock-persist 'history
 org-agenda-file-regexp "\\`[^.].*\\.org'\\|[0-9]+$"
 org-cycle-hook '(org-cycle-hide-archived-subtrees
                  org-cycle-hide-drawers org-cycle-show-empty-lines
                  org-optimize-window-after-visibility-change)
 org-journal-dir "~/media/org/journal/"
 org-journal-date-format "%A %e %B %Y"
 org-todo-keywords '((sequence "TODO(t)" "FEEDBACK(f)" "VERIFY(v)" "|"
                      "DONE(d)" "DELEGATED" "DROPPED")
                     )
 org-babel-tangle-lang-exts '(("haskell" . "hs") ("ruby" . "rb")
                              ("python" . "py") ("lisp" . "lisp")
                              ("latex" . "tex") ("java" . "java")
                              ("D" . "d") ("C++" . "cpp")
                              ("emacs-lisp" . "el") ("elisp" . "el"))
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-link-parameters '(("id" :follow org-id-open)
                       ("rmail" :follow org-rmail-open :store
                        org-rmail-store-link)
                       ("mhe" :follow org-mhe-open :store
                        org-mhe-store-link)
                       ("irc" :follow org-irc-visit :store
                        org-irc-store-link)
                       ("info" :follow org-info-open :export
                        org-info-export :store org-info-store-link)
                       ("gnus" :follow org-gnus-open :store
                        org-gnus-store-link)
                       ("docview" :follow org-docview-open :export
                        org-docview-export :store
                        org-docview-store-link)
                       ("bibtex" :follow org-bibtex-open :store
                        org-bibtex-store-link)
                       ("bbdb" :follow org-bbdb-open :export
                        org-bbdb-export :complete
                        org-bbdb-complete-link :store
                        org-bbdb-store-link)
                       ("w3m" :store org-w3m-store-link) ("file+sys")
                       ("file+emacs")
                       ("doi" :follow org--open-doi-link)
                       ("elisp" :follow org--open-elisp-link)
                       ("file" :complete org-file-complete-link)
                       ("ftp" :follow
                        (lambda (path)
                         (browse-url (concat "ftp:" path)))
                        )
                       ("help" :follow org--open-help-link)
                       ("http" :follow
                        (lambda (path)
                         (browse-url (concat "http:" path)))
                        )
                       ("https" :follow
                        (lambda (path)
                         (browse-url (concat "https:" path)))
                        )
                       ("mailto" :follow
                        (lambda (path)
                         (browse-url (concat "mailto:" path)))
                        )
                       ("news" :follow
                        (lambda (path)
                         (browse-url (concat "news:" path)))
                        )
                       ("shell" :follow org--open-shell-link))
 org-babel-load-languages '((C . t) (calc . t) (dot . t)
                            (emacs-lisp . t) (gnuplot . t) (java . t)
                            (js . t) (latex . t) (lisp . t)
                            (python . t) (ipython . t) (R . t)
                            (ruby . t) (scheme . t) (shell . t)
                            (sqlite . t) (haskell . t))
 org-reveal-start-hook '(org-decrypt-entry)
 org-agenda-mode-hook '(org-journal-update-org-agenda-files)
 org-agenda-files '("~/media/org/journal/")
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-confirm-babel-evaluate nil
 )

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug: If else blocks inside for loop fail in newest version [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/paul/org-mode/lisp/)]
  2018-12-19 10:21 Bug: If else blocks inside for loop fail in newest version [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/paul/org-mode/lisp/)] Paul Lodder
@ 2018-12-20 13:39 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2018-12-20 13:39 UTC (permalink / raw)
  To: Paul Lodder; +Cc: emacs-orgmode@gnu.org

Hello,

Paul Lodder <paul_lodder@live.nl> writes:

> If else blocks inside for loops in python cause IndentationError, it
> does accept the 'if' and the indented part below the 'if', but from
> 'else:' onwards the code is not evaluated anymore because of the
> 'unexpected indent'. I added an example code block in which this error
> occurs. The list 'odds' only contained even values.
>
> I fixed it by downgrading to an older release again.
>
> #+BEGIN_SRC python
>   even = []
>   for i in range(10):
>       if i % 2 == 0:
>           even.append(i)
>       else:
>           print("here")
>           even.append(("this should be in the list as well",))
>
>   even
> #+END_SRC

FWIW, I cannot reproduce your issue on master branch.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-20 13:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-19 10:21 Bug: If else blocks inside for loop fail in newest version [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/paul/org-mode/lisp/)] Paul Lodder
2018-12-20 13:39 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).