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))))
|
||||
|
||||
;;;###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
|
||||
buffer start and end, to make indentation consistent. Which it does depends on
|
||||
the value of `indent-tab-mode'."
|
||||
(interactive "r")
|
||||
the value of `indent-tab-mode'.
|
||||
|
||||
If ARG (universal argument) is non-nil, retab the current buffer using the
|
||||
opposite indentation style."
|
||||
(interactive "Pr")
|
||||
(unless (and beg end)
|
||||
(setq beg (point-min)
|
||||
end (point-max)))
|
||||
(let ((indent-tabs-mode (if arg (not indent-tabs-mode) indent-tabs-mode)))
|
||||
(if indent-tabs-mode
|
||||
(tabify beg end)
|
||||
(untabify beg end)))
|
||||
(untabify beg end))))
|
||||
|
||||
(defvar-local doom--buffer-narrowed-origin nil)
|
||||
;;;###autoload
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue