Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b053993

Browse files
committed
(py-delete-function): new variable
(py-delete-char): funcall py-delete-function.
1 parent 5c8bef1 commit b053993

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Misc/python-mode.el

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ Currently-active file is at the head of the list.")
275275
(and (fboundp 'make-obsolete-variable)
276276
(make-obsolete-variable 'py-mode-hook 'python-mode-hook))
277277

278+
(defvar py-delete-function 'backward-delete-char-untabify
279+
"*Function called by `py-delete-char' when deleting characters.")
280+
278281
(defvar py-mode-map ()
279282
"Keymap used in `python-mode' buffers.")
280283

@@ -992,7 +995,10 @@ See the `\\[py-execute-region]' docs for an account of some subtleties."
992995
;; Functions for Python style indentation
993996
(defun py-delete-char (count)
994997
"Reduce indentation or delete character.
998+
995999
If point is at the leftmost column, deletes the preceding newline.
1000+
Deletion is performed by calling the function in `py-delete-function'
1001+
with a single argument (the number of characters to delete).
9961002
9971003
Else if point is at the leftmost non-blank character of a line that is
9981004
neither a continuation line nor a non-indenting comment line, or if
@@ -1011,7 +1017,7 @@ argument delets that many characters."
10111017
(py-continuation-line-p)
10121018
(not py-honor-comment-indentation)
10131019
(looking-at "#[^ \t\n]")) ; non-indenting #
1014-
(backward-delete-char-untabify count)
1020+
(funcall py-delete-function count)
10151021
;; else indent the same as the colon line that opened the block
10161022

10171023
;; force non-blank so py-goto-block-up doesn't ignore it

0 commit comments

Comments
 (0)