@@ -97,26 +97,22 @@ each element is passed as argument to 'lintr::with_defaults'."
9797(defun ess-r--find-lintr-file ()
9898 " Return the absolute path to the .lintr file.
9999Check first the current directory, then the project root, then
100- the user's home directory. Return nil if we couldn't find a .lintr file."
101- (let ((cur-dir-file (expand-file-name " .lintr" default-directory))
102- (ess-proj-file (and (fboundp 'ess-r-package-project )
103- (ess-r-package-project)
104- (expand-file-name " .lintr" (cdr (ess-r-package-project)))))
105- (proj-file (and (project-current )
106- (ess--project-root (project-current ))
107- (expand-file-name " .lintr" (ess--project-root (project-current )))))
108- (home-file (expand-file-name " .lintr" (getenv " HOME" ))))
109- (cond (; ; current directory
110- (file-readable-p cur-dir-file)
111- cur-dir-file)
112- ; ; Project root according to `ess-r-package-project'
113- ((and ess-proj-file
114- (file-readable-p ess-proj-file))
115- ess-proj-file)
116- ; ; Project root according to `ess--project-root'
117- ((and proj-file
118- (file-readable-p proj-file)))
119- ; ; Home directory
100+ the package root, then the user's home directory. Return nil if
101+ we couldn't find a .lintr file."
102+ ; ; VS[2022-01-26]: Can't this entire thing be replaced by
103+ ; ; `(locate-dominating-file ".lintr")`?
104+ (let* ((cur-file (expand-file-name " .lintr" default-directory))
105+ (pkg (cdr (ess-r-package-project)))
106+ (pkg-file (and proj (expand-file-name " .lintr" pkg)))
107+ (proj (ess-r-project))
108+ (proj-file (and proj (expand-file-name " .lintr" proj)))
109+ (home-file (expand-file-name " .lintr" (getenv " HOME" ))))
110+ (cond ((file-readable-p cur-file)
111+ cur-file)
112+ ((and proj-file (file-readable-p proj-file))
113+ proj-file)
114+ ((and pkg-file (file-readable-p pkg-file))
115+ pkg-file)
120116 ((file-readable-p home-file)
121117 home-file))))
122118
0 commit comments