From 6a52ff91660c77e461f5894425e95e3ae4e6e39f Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Tue, 1 Sep 2026 22:07:39 -0700 Subject: [PATCH] Fix my/delete-backward-char-or-tab --- init.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/init.el b/init.el index da66494..0ce17c9 100644 --- a/init.el +++ b/init.el @@ -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 `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 -current line. +current line unless point is at the beginning of a line. 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) (>= (point) start)))) (count-chars-for-delete-tab () - (min (* (ceiling n tab-width) (if indent-tabs-mode 1 tab-width)) - (- (point) (pos-bol))))) + (if (bolp) + 1 + (min (* (ceiling n tab-width) (if indent-tabs-mode 1 tab-width)) + (- (point) (pos-bol)))))) (if (not (only-indentation-p)) (delete-char (- n) killflag) (delete-char (- (count-chars-for-delete-tab)) killflag))))