Closed ttybitnik closed 9 months ago
Hi @ttybitnik ! Thank you for PR! I didn't know about this, so I've merged immediately.
Hehe, fine. Actually, I think we will have to change it a bit.
I didn't see a void symbol warning for the return. Checking it now.
An error is displayed even if the file exists.
let: No Hugo config file found in ~/src/github.com/masasam/solistblog/
let: No Hugo config file found in ~/src/github.com/masasam/solist/
let: No Hugo config file found in ~/src/github.com/masasam/PPAP/
Yes, breaking the dolist was just wrong. I had an eglot warning that did'nt let me see these warnings.
Seems like this should do the trick.
(defun easy-hugo-open-config ()
"Open Hugo's config file."
(interactive)
(easy-hugo-with-env
(let ((config-files '("config.toml" "config.yaml" "config.json"
"hugo.toml" "hugo.yaml" "hugo.json")))
(catch 'found-config
(dolist (file config-files)
(let ((full-path (expand-file-name file easy-hugo-basedir)))
(when (file-exists-p full-path)
(find-file full-path)
(throw 'found-config t))))
(error "No Hugo config file found in %s" easy-hugo-basedir)))))
Otherwise, we can just go back to the cond and add new lists for the new basename.
It's perfect because there are no more errors. Would you like to pull request additionally? Or should I commit this?
Nice then. Please go ahead.
And sorry for not seeing this before the PR. My eglot warning got me in this one hehe
I got it. I'll commit it here. Thank you for always helping me here.
From v0.109.0 on, Hugo started using
hugo
as basename for its configuration files (https://gohugo.io/getting-started/configuration/#configuration-file).I've updated the
easy-hugo-open-config
function to support this new naming convention along with the old one.Tested locally with both basenames and worked fine.