Fix my/delete-backward-char-or-tab

This commit is contained in:
2026-09-01 22:07:39 -07:00
parent 8b7fdc5bd8
commit 6a52ff9166
+5 -3
View File
@@ -321,7 +321,7 @@ If there is only whitespace between point and the beginning of the current line,
delete N characters worth of tabs, rounding up. For example, if N is 2 and delete N characters worth of tabs, rounding up. For example, if N is 2 and
`tab-width' is 4, delete one tab. If `indent-tabs-mode' is nil, instead delete `tab-width' is 4, delete one tab. If `indent-tabs-mode' is nil, instead delete
`tab-width' spaces. In this case, deletion stops at the beginning of the `tab-width' spaces. In this case, deletion stops at the beginning of the
current line. current line unless point is at the beginning of a line.
If point is anywhere else on the line, delete N characters. If point is anywhere else on the line, delete N characters.
@@ -338,8 +338,10 @@ If KILLFLAG is non-nil, save the deleted text to the kill ring."
(backward-prefix-chars) (backward-prefix-chars)
(>= (point) start)))) (>= (point) start))))
(count-chars-for-delete-tab () (count-chars-for-delete-tab ()
(min (* (ceiling n tab-width) (if indent-tabs-mode 1 tab-width)) (if (bolp)
(- (point) (pos-bol))))) 1
(min (* (ceiling n tab-width) (if indent-tabs-mode 1 tab-width))
(- (point) (pos-bol))))))
(if (not (only-indentation-p)) (if (not (only-indentation-p))
(delete-char (- n) killflag) (delete-char (- n) killflag)
(delete-char (- (count-chars-for-delete-tab)) killflag)))) (delete-char (- (count-chars-for-delete-tab)) killflag))))