Function: editorconfig-apply

editorconfig-apply is an autoloaded, interactive and byte-compiled function defined in editorconfig-tools.el.gz.

This command is obsolete since 31.1; use hack-local-variables instead.

Signature

(editorconfig-apply)

Documentation

Get and apply EditorConfig properties to current buffer.

Probably introduced at or before Emacs version 31.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/editorconfig-tools.el.gz
;;;###autoload
(defun editorconfig-apply ()
  "Get and apply EditorConfig properties to current buffer."
  (declare (obsolete hack-local-variables "31.1"))
  (interactive)
  (when buffer-file-name
    (condition-case err
        (progn
          (let ((props (editorconfig-call-get-properties-function buffer-file-name)))
            (condition-case err
                (run-hook-with-args 'editorconfig-hack-properties-functions props)
              (error
               (display-warning '(editorconfig editorconfig-hack-properties-functions)
                                (format "Error while running editorconfig-hack-properties-functions, abort running hook: %S"
                                        err)
                                :warning)))
            (setq editorconfig-properties-hash props)
            (editorconfig-set-local-variables props)
            (editorconfig-set-coding-system-revert
             (gethash 'end_of_line props)
             (gethash 'charset props))
            (condition-case err
                (run-hook-with-args 'editorconfig-after-apply-functions props)
              (error
               (display-warning '(editorconfig editorconfig-after-apply-functions)
                                (format "Error while running editorconfig-after-apply-functions, abort running hook: %S"
                                        err)
                                :warning)))))
      (error
       (display-warning '(editorconfig editorconfig-apply)
                        (format "Error in editorconfig-apply, styles will not be applied: %S" err)
                        :error)))))