Skip to content

bug: error when invoke delete when cursor is before end-of-indentation in python buffer #16

@tu10ng

Description

@tu10ng

im using emacs 29: GNU Emacs 29.2 (build 2, x86_64-w64-mingw32) of 2024-02-02

  • error image:

image

  • cause error when cursor is before end-of-indentation, including cursor on the beginning-of-line.

for example, open a new python buffer, enter some new lines, and invoke delete key.

i think its because the code below:

(defcustom smart-hungry-delete-major-mode-dedent-function-alist '((python-mode . (lambda () (interactive) (python-indent-dedent-line-backspace nil))))
  "Number of characters to search back in the most."
  :safe t)

we shouldnt use nil as parameter for function python-indent-dedent-line-backspace, as it wants a numeric value.

  • a quickfix could be this:
(setq smart-hungry-delete-major-mode-dedent-function-alist
      '((python-mode . (lambda ()
                         (interactive)
                         (if (bolp)
                             (python-indent-dedent-line-backspace 1)
                           (python-indent-dedent-line-backspace (current-column)))))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions