all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#15975: 24.3.50; Arithmetic error upon calling `python-indent-line` in a buffer of a single non-empty line.
@ 2013-11-25 20:49 James De Ricco
  2013-11-26  3:16 ` Glenn Morris
  0 siblings, 1 reply; 2+ messages in thread
From: James De Ricco @ 2013-11-25 20:49 UTC (permalink / raw
  To: 15975

An Arithmetic error is raised when the `python-indent-line` function is
called on a buffer consisting of one non-empty line.

cd src/emacs-bzr/install-prefix/bin/
./emacs -Q
C-x b pybuf <RET> def main(): M-x python-mode <RET> C-j

*Messages* buffer:
  For information about GNU Emacs and the GNU system, type C-h C-a.
  python-indent-line: Arithmetic error

*Backtrace* buffer:
  Debugger entered--Lisp error: (arith-error)
    python-indent-calculate-levels()
    python-indent-line()
    python-indent-line-function()
    indent-according-to-mode()
    newline-and-indent()
    call-interactively(newline-and-indent nil nil)
    command-execute(newline-and-indent)

The patch below resolves the problem by ensuring that the function
`python-indent-guess-indent-offset` does not set `python-indent-offset`
to zero, thereby violating the precondition of the function
`python-indent-calculate-levels` which expects `python-indent-offset` to
not equal zero (otherwise attempts to modulus a number and zero). It
makes sense that `python-indent-offset` would never equal zero since the
python language requires non-zero level indentation of blocks.

*** python.el.original  2013-11-25 14:48:53.118763386 -0500
--- python.el   2013-11-25 14:49:32.601625243 -0500
***************
*** 676,682 ****
                   (goto-char block-end)
                   (python-util-forward-comment)
                   (current-indentation))))
!           (if indentation
                (set (make-local-variable 'python-indent-offset)
indentation)
              (message "Can't guess python-indent-offset, using
defaults: %s"
                       python-indent-offset)))))))
--- 676,682 ----
                   (goto-char block-end)
                   (python-util-forward-comment)
                   (current-indentation))))
!           (if (> indentation 0)
                (set (make-local-variable 'python-indent-offset)
indentation)
              (message "Can't guess python-indent-offset, using
defaults: %s"
                       python-indent-offset)))))))


In GNU Emacs 24.3.50.3 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll
bars)
 of 2013-11-25 on jcdericco-MacBookPro-GNU
Bzr revision: 115235 bozhidar@batsov.com-20131125190450-w5yaffnkd8ti4o5z
Windowing system distributor `The X.Org Foundation', version 11.0.11103000
System Description:    Trisquel 6.0

Configured using:
 `configure --prefix=/home/jcdericco/src/emacs-bzr/install-prefix/'

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer 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 make-network-process inotify
dynamic-setting x-toolkit x multi-tty emacs)






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

* bug#15975: 24.3.50; Arithmetic error upon calling `python-indent-line` in a buffer of a single non-empty line.
  2013-11-25 20:49 bug#15975: 24.3.50; Arithmetic error upon calling `python-indent-line` in a buffer of a single non-empty line James De Ricco
@ 2013-11-26  3:16 ` Glenn Morris
  0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2013-11-26  3:16 UTC (permalink / raw
  To: 15975-done

Version: 24.4

Thanks; fixed.





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

end of thread, other threads:[~2013-11-26  3:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-25 20:49 bug#15975: 24.3.50; Arithmetic error upon calling `python-indent-line` in a buffer of a single non-empty line James De Ricco
2013-11-26  3:16 ` Glenn Morris

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.