branch: scratch/editorconfig-cc commit d1ea0124c5df342391a076796d60f8bb4283cd59 Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
Do nothing when current buffer does not visit any file --- editorconfig.el | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index 64909c0052..2ec930e9e6 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -202,14 +202,16 @@ NOTE: Only the **buffer local** value of VARIABLE will be set." nil)) (defun editorconfig-apply () - (let ((props (and (functionp editorconfig-get-properties-function) - (funcall editorconfig-get-properties-function)))) - (if props - (progn - (editorconfig-set-line-length (gethash 'max_line_length props)) - (dolist (hook editorconfig-custom-hooks) - (funcall hook props))) - (display-warning :error "EditorConfig core program is not available. Styles will not be applied.")))) + (when buffer-file-name + (let ((props (and (functionp editorconfig-get-properties-function) + (funcall editorconfig-get-properties-function)))) + (if props + (progn + (editorconfig-set-line-length (gethash 'max_line_length props)) + (dolist (hook editorconfig-custom-hooks) + + (funcall hook props))) + (display-warning :error "EditorConfig core program is not available. Styles will not be applied."))))) ;;;###autoload (define-minor-mode editorconfig-mode