From 700d0da6b7cafb68755d3b4a5b1a88f6f5f21d6d Mon Sep 17 00:00:00 2001 From: MitchMarq42 Date: Wed, 11 Jan 2023 08:02:47 -0900 Subject: [PATCH] hugo: use named-let to avoid hypothetical stack overflow --- lisp/mitch-packages.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/mitch-packages.el b/lisp/mitch-packages.el index e51061b..c155742 100644 --- a/lisp/mitch-packages.el +++ b/lisp/mitch-packages.el @@ -649,9 +649,10 @@ See https://emacs.stackexchange.com/questions/2538/how-to-define-additional-mode (defun hugo-dir-above (dir) "Return path of Hugo project root above or at DIR. Return nil if DIR is not in a hugo project at all." - (if (eq dir nil) nil - (if (file-exists-p (expand-file-name "config.toml" dir)) dir - (hugo-dir-above (file-name-directory (string-trim-right dir "/")))))) + (named-let hda-internal ((dir dir)) + (if (eq dir nil) nil + (if (file-exists-p (expand-file-name "config.toml" dir)) dir + (hda-internal (file-name-directory (string-trim-right dir "/"))))))) (defun hugo-compile (dir) (let ((hugo-dir (hugo-dir-above dir))) (if hugo-dir