branch: scratch/editorconfig-cc commit ad59db4e8bfdc5d3abf218b16dfdd583a08c1746 Author: 10sr <8.slas...@gmail.com> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
Fix when-let (again) (#305) * Fix compile of editorconfig-core * Use when-let* instead of when-let --- editorconfig-core.el | 7 +++++-- editorconfig.el | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/editorconfig-core.el b/editorconfig-core.el index 4ac1fcbb9d..43ce948824 100644 --- a/editorconfig-core.el +++ b/editorconfig-core.el @@ -68,6 +68,9 @@ (require 'editorconfig-core-handle) +(eval-when-compile + (require 'subr-x)) + (defun editorconfig-core--get-handles (dir confname &optional result) "Get list of EditorConfig handlers for DIR from CONFNAME. @@ -90,7 +93,7 @@ RESULT is used internally and normally should not be used." ;;;###autoload (defun editorconfig-core-get-nearest-editorconfig (directory) "Return path to .editorconfig file that is closest to DIRECTORY." - (when-let ((handle (car (last + (when-let* ((handle (car (last (editorconfig-core--get-handles directory ".editorconfig"))))) (editorconfig-core-handle-path handle))) @@ -144,7 +147,7 @@ hash object instead." ;; Downcase known boolean values (dolist (key '( end_of_line indent_style indent_size insert_final_newline trim_trailing_whitespace charset)) - (when-let ((val (gethash key result))) + (when-let* ((val (gethash key result))) (puthash key (downcase val) result))) ;; Add indent_size property diff --git a/editorconfig.el b/editorconfig.el index 123eb86dcd..4a02bb9c42 100644 --- a/editorconfig.el +++ b/editorconfig.el @@ -803,7 +803,7 @@ To disable EditorConfig in some buffers, modify "Find the closest .editorconfig file for current file." (interactive) (eval-and-compile (require 'editorconfig-core)) - (when-let ((file (editorconfig-core-get-nearest-editorconfig + (when-let* ((file (editorconfig-core-get-nearest-editorconfig default-directory))) (find-file file)))