An Emacs mode for editing Python code

News and announcements

New in version 6.1.3

Written for python-mode.el by Andreas Roehler on 2014-01-28

- PEP8 indent-alternatives when closing a list implemented

Boolean `py-close-at-start-column-p', default is nil

my_list = [
    1, 2, 3,
    4, 5, 6,
    ]
result = some_function_that_takes_arguments(
    'a', 'b', 'c',
    'd', 'e', 'f',
    )

When non-nil, it will be lined up under the first character of the line that starts the multi-line construct, as in:

my_list = [
    1, 2, 3,
    4, 5, 6,
]

result = some_function_that_takes_arguments(
    'a', 'b', 'c',
    'd', 'e', 'f',
)

- Keys C-M-a, C-M-e usable for all top-level form, lp:1191078

  Boolean `py-defun-use-top-level-p'
  If non-nil, beginning- end-of-defun forms will use
  `py-beginning-of-top-level', `py-end-of-top-level',
  mark-defun marks top-level form at point etc.

Keys C-M-a, C-M-e usable for all top-level form, lp:1191078

- New commands:
  py-beginning-of-block-current-column
  "Reach the beginning of block which starts at current column "

  py-beginning-of-top-level
  py-beginning-of-top-level
  py-end-of-top-level
  py-mark-top-level
  py-copy-top-level
  py-delete-top-level
  py-kill-top-level
  py-execute-top-level
  py-top-level-form-p
  py-comment-top-level
  py-beginning-of-top-level-p

- `minor-block' commands added
  A minor block is started by a `for', `if', `try' or `with',
  while block covers also `def' or `class'

- variable `py-keep-windows-configuration', default is nil
  Setting `py-keep-windows-configuration' to `t' will
  restore windows-configuration regardless of
  `py-switch-buffers-on-execute-p' and
  `py-split-windows-on-execute-p' settings. However, if
  an error occurs, it's displayed.

  To suppres window-changes due to error-signaling
  also, set `py-keep-windows-configuration' onto 'force

- boolean empty-line-closes-p, default is nil
  When non-nil, dedent after empty line following block
  If non-nil, a C-j from empty line would dedent.

  if True:
      print("Part of the if-statement")

  print("Not part of the if-statement")

- boolean py-debug-p, default is nil
  When non-nil, keep resp. store information useful for
  debugging. Temporary files are not deleted. Other
  functions might implement some logging etc.

- heuristic exit
  new var `py-max-specpdl-size', default is `max-specpdl-size'
  py-end-of-statement will error if number of
  `py-max-specpdl-size' loops is completed, thus avoiding
  a hang from a possibly eternal loop.

- `py-statement' no longer refferred to `py-copy-statement'
  Same with block, def, expression etc. `py-statement' made
  own command, which returns statement, a string.

- boolean `py-max-help-buffer-p', default is nil
  If "*Python-Help*"-buffer be the only visible.

Updated on 2014-01-28.

New in version 6.1.2

Written for python-mode.el by Andreas Roehler on 2013-09-02

- simplified menu

- `py-execute-...'-commands return result as string
  Controlled by boolean `py-store-result-p', Default is nil
  When non-nil, put resulting string of `py-execute-...' into kill-ring, so it might be yanked.

- commands deleting all commented lines:
  `py-delete-comments-in-def-or-class'
  `py-delete-comments-in-class'
  `py-delete-comments-in-block'
  `py-delete-comments-in-region'

- boolean `py-indent-paren-spanned-multilines-p, default is nil
  If non-nil, indents elements of list a value of `py-indent-offset' to first element:
  def foo():
      if (foo &&
              baz):
          bar()

  Default lines up with first element:

  def foo():
      if (foo &&
          baz):
          bar()

- `py-output-buffer' made customizable
  See boolean `py-enforce-output-buffer-p'

- exceptions following executed regions made point to source

- command `py-empty-out-list-backward'
  Deletes all elements from list before point
  With when cursor after
  mystring[0:1]
  -------------^
  ==>
  mystring[]
  ---------^
  In result cursor is insided emptied delimited form."

- `py-minor-expression' reconsidered, numeric args dropped
  grasps keyword-arguments

- boolean `py-electric-kill-backward-p', default is nil.
  If behind a delimited form of braces, brackets or parentheses,
  `py-electric-backspace' runs `py-empty-out-list-backward'

- py-flakes8-run, flakes8 API

- customizable `py-backslashed-lines-indent-offset'

- boolean `py-pylint-offer-current-p'
  If current buffers file should be offered for check.
  Otherwise `py-pylint-run' looks up filename from history

- boolean `py-prompt-on-changed-p'
  When called interactively, ask for save before a
  changed buffer is sent to interpreter.

- customizable `py-closing-list-space'
  Number of chars, closing parenthesis outdent from opening

- customizable `py-uncomment-indents-p'
  When non-nil, after uncomment indent lines.

- boolean `py-load-skeletons-p'
  If skeleton definitions should be loaded

- boolean `py-if-name-main-permission-p'
  Allows execution of code inside blocks started by
  if __name__== '__main__'

- boolean `py-highlight-error-source-p', default is nil
  When py-execute-... commands raise an error, respective code in source-buffer will be highlighted.

- `py-remove-overlays-at-point', command
  Remove overlays as set when `py-highlight-error-source-p' is non-nil.

- `py-which-def-or-class', command, now used `which-function-mode'

- unused variable `py-backspace-function' removed

- Bundled third-party-stuff removed as reported conflicting at emacs-mirror, lp:1153998
  affects autopair.el, smart-operator.el
  Kept menu switches resp. commands will issue a warning

- dropped `py-paragraph-fill-docstring-p'; just `fill-paragraph' should DTRT

- `py-set-pager-cat-p', default is nil
   If non-nil, $PAGER is set to 'cat'

- in directory doc customizable variables are listed:
  variables-python-mode.org, variables-python-mode.rst

Caveat: Please save buffer before C-c C-c, otherwise a bug shows up.
Bug is fixed in current trunk.

Updated on 2013-11-19.

python-mode.el-6.1.1

Written for python-mode.el by Andreas Roehler on 2013-02-23

New in version 6.1.1
---------------------

- comment-related commands:
  py-uncomment
  py-comment-block, py-comment-clause,
  py-comment-block-or-clause, py-comment-def,
  py-comment-class, py-comment-def-or-class,
  py-comment-statement

- boolean `py-set-fill-column-p'
  If `t', enables use Python specific `fill-column' according to
  `py-docstring-fill-column', default is 72
  and `py-comment-fill-column, default is 79

- boolean `py-tab-shifts-region-p'
  when `t', TAB will indent/cycle the region, not just the current line.

- boolean `py-tab-indents-region-p'
  when `t', when first TAB doesn't shift, `indent-region' is called

- command from RET customizable via `py-return-key':
  `py-newline-and-indent', `newline' or `py-newline-and-dedent'

- boolean `py-use-font-lock-doc-face-p', default is nil
  If non-nil, documention strings get `font-lock-doc-face'

- boolean `py-newline-delete-trailing-whitespace-p'
  Delete trailing whitespace maybe left by `py-newline-and-indent'

- `py-electric-comment-p' new default nil

- py-up minor API change
  If inside a delimited form --string or list-- go to it's beginning
  If not at beginning of a statement or block, go to it's beginning
  If at beginning of a statement or block, go to beginning one level above of c

- py-down minor API change:
  Go to beginning of one level below of compound statement or definition at point.
  If no statement or block below, but a delimited form --string or list-- go to it's beginning.
  Repeated call from there will behave like down-list.

- commands make underscore syntax changes easier:
  toggle-py-underscore-word-syntax-p
  py-underscore-word-syntax-p-on
  py-underscore-word-syntax-p-off

- py-update-imports removed
  Do not maintain a static variable containing needed imports
  Determine imports on the fly rather, as it might change
  the very moment

- variable `py-fill-docstring-style' renamed `py-docstring-style'

python-mode.el-6.1.0

Written for python-mode.el by Andreas Roehler on 2012-12-05

New in version 6.1.0
---------------------

- py-up
  Go to beginning one level above of compound statement or definition at point.
- py-down
  Go to beginning one level below of compound statement or definition at point.

- Customizable output directory
  After checking for a remote shell, the following variables are consulted:

  py-use-current-dir-when-execute-p, default t
  When `t', current directory is used by Python-shell for output of `py-execute-buffer' and related commands

  py-fileless-buffer-use-default-directory-p, default t
  When `py-use-current-dir-when-execute-p' is non-nil and no buffer-file exists, value of `default-directory' sets current working directory of Python output shell"

  py-keep-shell-dir-when-execute-p, default nil
  Don't change Python shell's current working directory when sending code.

  `py-execute-directory', default nil

  If nothing was set so far, $VIRTUAL_ENV and $HOME are queried.

- Set of commands calling Python3.3

- fill docstrings according to style, commands
  py-fill-string-django
  py-fill-string-onetwo
  py-fill-string-pep-257
  py-fill-string-pep-257-nn
  py-fill-string-symmetric

  Customizable variable `py-fill-docstring-style' provides default value
  used by `py-fill-string', `py-fill-paragraph'

  DJANGO:

      \"\"\"
      Process foo, return bar.
      \"\"\"

      \"\"\"
      Process foo, return bar.

      If processing fails throw ProcessingError.
      \"\"\"

  ONETWO:

      \"\"\"Process foo, return bar.\"\"\"

      \"\"\"
      Process foo, return bar.

      If processing fails throw ProcessingError.

      \"\"\"

  PEP-257:

      \"\"\"Process foo, return bar.\"\"\"

      \"\"\"Process foo, return bar.

      If processing fails throw ProcessingError.

      \"\"\"

  PEP-257-NN:

      \"\"\"Process foo, return bar.\"\"\"

      \"\"\"Process foo, return bar.

      If processing fails throw ProcessingError.
      \"\"\"

  SYMMETRIC:

      \"\"\"Process foo, return bar.\"\"\"

      \"\"\"
      Process foo, return bar.

      If processing fails throw ProcessingError.
      \"\"\""

  Built upon code seen at python.el, thanks Fabian

- `py-down-statement', `py-up-statement'

- toggle-py-split-windows-on-execute-p
- py-split-windows-on-execute-p-off
- py-split-windows-on-execute-p-on

- toggle-py-switch-buffers-on-execute-p
- py-switch-buffers-on-execute-p-on
- py-switch-buffers-on-execute-p-off

- `py-shell-switch-buffers-on-execute-p' renamed `py-switch-buffers-on-execute-p'

python-mode.el-6.0.12

Written for python-mode.el by Andreas Roehler on 2012-09-28

New in version 6.0.12
---------------------

- py-sexp-function.

 When set, it's value is called instead of `forward-sexp', `backward-sexp
  Choices are py-partial-expression, py-expression, default nil

- `py-partial-expression' reconsidered.
   Beside common moves like `defun', `statement' specific Python-mode edits are delivered:

  `py-expression' and `py-partial-expression'.

  Statement below is considered composed of two `py-expression'

  a = ['spam', 'eggs', 100, 1234]
  |_| |_________________________|

  Assigment operator and all inside comments is ignored.

  `py-partial-expression' would match six sections

   a = ['spam', 'eggs', 100, 1234]
  |_| |_____| |____| |__| |__|
       |_________________________|

  When traversing code, `py-partial-expression' climbs down and up
  all levels encountered, i.e. at opening `[' `py-expression' would return ['spam', 'eggs', 100, 1234], while one char behind at `''
  it yields `'spam','

- `py-find-definition' also detects non-imported definition in current buffer

- Choice between `py-imenu-create-index-new' and series 5.
  py-imenu-create-index-function made easier.
  Customizable variable `py-imenu-create-index-function' provided, see also
  command in PyTools

- New commands addressing BOL as start/end:
  py-beginning-of-block-bol
  py-end-of-block-bol
  py-mark-block-bol
  py-copy-block-bol
  py-kill-block-bol
  py-delete-block-bol
  py-end-of-clause-bol
  etc.

- While commands "py-beginning..." resp. "py-end..." compute the context,
  selecting the corresponding beginning or end,
  new "py-up...", "py-down..." jump regexp-based to the
  next element in buffer.
  See also menu PyEdit

Updated on 2012-09-28.

15 of 20 results

Announcements