bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#77981: 30.1; kill-ring-deindent-mode replaces spaces with tabs even


From: spl3g
Subject: bug#77981: 30.1; kill-ring-deindent-mode replaces spaces with tabs even when indent-tabs-mode is nil
Date: Sat, 26 Apr 2025 16:36:50 +0300

Thank you, the patch fixed the problem.

сб, 26 апр. 2025 г. в 16:13, Eli Zaretskii <eliz@gnu.org>:
> From: spl3g <spleefer6@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))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]