Skip to content

Commit

Permalink
Disable delete-trailing-whitespace when buffer-read-only is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
10sr committed Jul 8, 2018
1 parent 616cbf0 commit c895d8d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions editorconfig.el
Original file line number Diff line number Diff line change
Expand Up @@ -395,13 +395,15 @@ number - `lisp-indent-offset' is not set only if indent_size is
"Set up trimming of trailing whitespace at end of lines by
TRIM-TRAILING-WS."
(make-local-variable 'write-file-functions) ;; just current buffer
(when (equal trim-trailing-ws "true")
(when (and (equal trim-trailing-ws "true")
(not buffer-read-only))
;; when true we push delete-trailing-whitespace (emacs > 21)
;; to write-file-functions
(add-to-list
'write-file-functions
'delete-trailing-whitespace))
(when (equal trim-trailing-ws "false")
(when (or (equal trim-trailing-ws "false")
buffer-read-only)
;; when false we remove every delete-trailing-whitespace
;; from write-file-functions
(setq
Expand Down

0 comments on commit c895d8d

Please sign in to comment.