hugo: use named-let to avoid hypothetical stack overflow
This commit is contained in:
parent
41313be8a6
commit
700d0da6b7
@ -649,9 +649,10 @@ See https://emacs.stackexchange.com/questions/2538/how-to-define-additional-mode
|
|||||||
(defun hugo-dir-above (dir)
|
(defun hugo-dir-above (dir)
|
||||||
"Return path of Hugo project root above or at DIR.
|
"Return path of Hugo project root above or at DIR.
|
||||||
Return nil if DIR is not in a hugo project at all."
|
Return nil if DIR is not in a hugo project at all."
|
||||||
(if (eq dir nil) nil
|
(named-let hda-internal ((dir dir))
|
||||||
(if (file-exists-p (expand-file-name "config.toml" dir)) dir
|
(if (eq dir nil) nil
|
||||||
(hugo-dir-above (file-name-directory (string-trim-right dir "/"))))))
|
(if (file-exists-p (expand-file-name "config.toml" dir)) dir
|
||||||
|
(hda-internal (file-name-directory (string-trim-right dir "/")))))))
|
||||||
(defun hugo-compile (dir)
|
(defun hugo-compile (dir)
|
||||||
(let ((hugo-dir (hugo-dir-above dir)))
|
(let ((hugo-dir (hugo-dir-above dir)))
|
||||||
(if hugo-dir
|
(if hugo-dir
|
||||||
|
Loading…
Reference in New Issue
Block a user