Skip to content

Commit fd128f6

Browse files
committed
fix(flymake): fix finding the .clang-tidy file
1 parent dc0da27 commit fd128f6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

core/me-lib.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ that directory."
746746

747747
(defun +directory-root-containing-file (files &optional start-path)
748748
"Return the path containing a file from FILES starting from START-PATH."
749-
(let ((dir (or start-path (buffer-file-name))))
749+
(let ((dir (or start-path (and buffer-file-name (file-name-directory buffer-file-name)) default-directory)))
750750
(catch 'root
751751
(while dir
752752
(when (cl-some #'file-exists-p (mapcar (+apply-partially-right #'expand-file-name dir) (ensure-list files)))

modules/me-checkers.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ This uses `project', `projectile', `vc' or the \".clang-tidy\" file"
138138
(and (project-current) (project-root (project-current)))
139139
(when (and (featurep 'projectile) (bound-and-true-p projectile-mode)) (projectile-project-root))
140140
(vc-root-dir)
141-
(+directory-root-containing-file (buffer-file-name) ".clang-tidy")
141+
(+directory-root-containing-file ".clang-tidy")
142142
(progn
143143
(message "Could not determine project root, trying current directory.")
144-
(file-name-directory (buffer-file-name)))))
144+
(file-name-directory buffer-file-name))))
145145

146146
(defun flymake-clang-tidy-get-config ()
147147
"Find and read .clang-tidy."

0 commit comments

Comments
 (0)