Make whitespace-injection more robust
+ No longer try to affect read-only buffers + Only activate if indent-tabs-mode is nil (spaces)
This commit is contained in:
parent
9c9e410898
commit
8f9bd835a5
1 changed files with 14 additions and 13 deletions
|
@ -198,10 +198,10 @@ mode is detected.")
|
|||
buffer so that `highlight-indentation-mode' will display uninterrupted indent
|
||||
markers. This whitespace is stripped out on save, as not to affect the resulting
|
||||
file."
|
||||
(interactive (progn (barf-if-buffer-read-only)
|
||||
(if (use-region-p)
|
||||
(interactive (if (use-region-p)
|
||||
(list (region-beginning) (region-end))
|
||||
(list nil nil))))
|
||||
(list nil nil)))
|
||||
(barf-if-buffer-read-only)
|
||||
(unless indent-tabs-mode
|
||||
(with-silent-modifications
|
||||
(save-excursion
|
||||
|
@ -229,6 +229,7 @@ file."
|
|||
nil)
|
||||
|
||||
(defun doom|init-highlight-indentation ()
|
||||
(unless (or indent-tabs-mode buffer-read-only)
|
||||
(if (or highlight-indentation-mode highlight-indentation-current-column-mode)
|
||||
(progn
|
||||
(doom|inject-trailing-whitespace)
|
||||
|
@ -237,7 +238,7 @@ file."
|
|||
(remove-hook 'before-save-hook #'delete-trailing-whitespace t)
|
||||
(remove-hook 'after-save-hook #'doom|inject-trailing-whitespace t)
|
||||
(with-silent-modifications
|
||||
(delete-trailing-whitespace))))
|
||||
(delete-trailing-whitespace)))))
|
||||
(add-hook! (highlight-indentation-mode highlight-indentation-current-column-mode)
|
||||
#'doom|init-highlight-indentation))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue