Change doom/retab to reformat w/ opposite style if ARG
This commit is contained in:
parent
b7b1445712
commit
af7fb1c628
1 changed files with 10 additions and 6 deletions
|
@ -215,17 +215,21 @@ possible, or just one char if that's not possible."
|
||||||
(t (delete-char (- n) killflag))))
|
(t (delete-char (- n) killflag))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/retab (&optional beg end)
|
(defun doom/retab (arg &optional beg end)
|
||||||
"Converts tabs-to-spaces or spaces-to-tabs within BEG and END (defaults to
|
"Converts tabs-to-spaces or spaces-to-tabs within BEG and END (defaults to
|
||||||
buffer start and end, to make indentation consistent. Which it does depends on
|
buffer start and end, to make indentation consistent. Which it does depends on
|
||||||
the value of `indent-tab-mode'."
|
the value of `indent-tab-mode'.
|
||||||
(interactive "r")
|
|
||||||
|
If ARG (universal argument) is non-nil, retab the current buffer using the
|
||||||
|
opposite indentation style."
|
||||||
|
(interactive "Pr")
|
||||||
(unless (and beg end)
|
(unless (and beg end)
|
||||||
(setq beg (point-min)
|
(setq beg (point-min)
|
||||||
end (point-max)))
|
end (point-max)))
|
||||||
(if indent-tabs-mode
|
(let ((indent-tabs-mode (if arg (not indent-tabs-mode) indent-tabs-mode)))
|
||||||
(tabify beg end)
|
(if indent-tabs-mode
|
||||||
(untabify beg end)))
|
(tabify beg end)
|
||||||
|
(untabify beg end))))
|
||||||
|
|
||||||
(defvar-local doom--buffer-narrowed-origin nil)
|
(defvar-local doom--buffer-narrowed-origin nil)
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue