GNU bug report logs -
#77981
30.1; kill-ring-deindent-mode replaces spaces with tabs even when indent-tabs-mode is nil
Previous Next
Reported by: spl3g <spleefer6 <at> gmail.com>
Date: Tue, 22 Apr 2025 08:23:02 UTC
Severity: normal
Found in version 30.1
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> From: spl3g <spleefer6 <at> gmail.com>
> Date: Tue, 22 Apr 2025 11:22:26 +0300
>
> When enabling kill-ring-deindent-mode, it would replace spaces with tabs
> in modes with indent-tabs-mode turned off.
> It breaks some languages, that do not support tabs for example elm and
> yaml.
>
> I think it is because the temp buffer it creates has indent-tabs-mode
> turned on by default.
Thank you for your report. Does the patch below give good results?
diff --git a/lisp/indent-aux.el b/lisp/indent-aux.el
index 27d5875..ce98944 100644
--- a/lisp/indent-aux.el
+++ b/lisp/indent-aux.el
@@ -45,10 +45,14 @@ kill-ring-deindent-buffer-substring-function
end (max a b)))
(let ((indentation (save-excursion (goto-char beg)
(current-column)))
+ (i-t-m indent-tabs-mode)
(text (if delete
(delete-and-extract-region beg end)
(buffer-substring beg end))))
(with-temp-buffer
+ ;; Indent/deindent the same as the major mode in the original
+ ;; buffer.
+ (setq indent-tabs-mode i-t-m)
(insert text)
(indent-rigidly (point-min) (point-max)
(- indentation))
This bug report was last modified 23 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.