branch: scratch/editorconfig-cc commit 75139b95dafd23972a3e8d92304a1af17fde66ee Author: 10sr <8slashes+...@gmail.com> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
Use dedicated functions to manipulate hook --- editorconfig.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/editorconfig.el b/editorconfig.el index b5ca482ee8..11865547c7 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -80,7 +80,7 @@ The hook does not have to be coding style related; you can add whatever functionality you want. For example, the following is an example to add a new property emacs_linum to decide whether to show line numbers on the left - (add-to-list 'editorconfig-custom-hooks + (add-hook 'editorconfig-custom-hooks '(lambda (props) (let ((show-line-num (gethash 'emacs_linum props))) (cond ((equal show-line-num \"true\") (linum-mode 1)) @@ -233,11 +233,9 @@ It calls `editorconfig-get-properties-from-exec' if (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))) + (progn + (editorconfig-set-line-length (gethash 'max_line_length props)) + (run-hook-with-args 'editorconfig-custom-hooks props)) (display-warning :error "EditorConfig core program is not available. Styles will not be applied."))))) ;;;###autoload