Function: editorconfig--advice-find-file-noselect
editorconfig--advice-find-file-noselect is a byte-compiled function
defined in editorconfig.el.gz.
Signature
(editorconfig--advice-find-file-noselect F FILENAME &rest ARGS)
Documentation
Get EditorConfig properties and apply them to buffer to be visited.
This function should be added as an advice function to find-file-noselect.
F is that function, and FILENAME and ARGS are arguments passed to F.
Source Code
;; Defined in /usr/src/emacs/lisp/editorconfig.el.gz
(defun editorconfig--advice-find-file-noselect (f filename &rest args)
"Get EditorConfig properties and apply them to buffer to be visited.
This function should be added as an advice function to `find-file-noselect'.
F is that function, and FILENAME and ARGS are arguments passed to F."
(let ((props nil)
(ret nil))
(condition-case err
(when (stringp filename)
(setq props (editorconfig-call-get-properties-function filename)))
(error
(display-warning '(editorconfig editorconfig--advice-find-file-noselect)
(format "Failed to get properties, styles will not be applied: %S"
err)
:warning)))
(setq ret (apply f filename args))
(condition-case err
(with-current-buffer ret
(when props
;; NOTE: hack-properties-functions cannot affect coding-system value,
;; because it has to be set before initializing buffers.
(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)
;; When initializing buffer, `editorconfig-major-mode-hook'
;; will be called before setting `editorconfig-properties-hash', so
;; execute this explicitly here.
(editorconfig-set-local-variables props)
(condition-case err
(run-hook-with-args 'editorconfig-after-apply-functions props)
(error
(display-warning '(editorconfig editorconfig--advice-find-file-noselect)
(format "Error while running `editorconfig-after-apply-functions': %S"
err))))))
(error
(display-warning '(editorconfig editorconfig--advice-find-file-noselect)
(format "Error while setting variables from EditorConfig: %S" err))))
ret))