Function: editorconfig--get-trailing-ws

editorconfig--get-trailing-ws is a byte-compiled function defined in editorconfig.el.gz.

Signature

(editorconfig--get-trailing-ws PROPS)

Documentation

Get vars to trim of trailing whitespace according to PROPS.

Source Code

;; Defined in /usr/src/emacs/lisp/editorconfig.el.gz
(defun editorconfig--get-trailing-ws (props)
  "Get vars to trim of trailing whitespace according to PROPS."
  (pcase (gethash 'trim_trailing_whitespace props)
    ("true"
     `((eval
        . ,(if editorconfig-trim-whitespaces-mode
               `(,editorconfig-trim-whitespaces-mode 1)
             '(add-hook 'before-save-hook
                        #'editorconfig--delete-trailing-whitespace nil t)))))
    ("false"
     ;; Just do it right away rather than return a (VAR . VAL), which
     ;; would be probably more trouble than it's worth.
     (when editorconfig-trim-whitespaces-mode
       (funcall editorconfig-trim-whitespaces-mode 0))
     (remove-hook 'before-save-hook
                  #'editorconfig--delete-trailing-whitespace t)
     nil)))