Skip to content

Commit

Permalink
Fix when-let (again) (#305)
Browse files Browse the repository at this point in the history
* Fix compile of editorconfig-core

* Use when-let* instead of when-let
  • Loading branch information
10sr authored May 19, 2023
1 parent a8b31c9 commit f5fc0eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions editorconfig-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)))
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion editorconfig.el
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,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)))

Expand Down

0 comments on commit f5fc0eb

Please sign in to comment.