Subject: Re: bug#41977: 28.0.50; [PATCH]: eval-when-compile eshell in project.el

From: Theodor Thornhill <[email-masked]>
Date: Sun, 21 Jun 2020 17:44:24 +0000

"Basil L. Contovounesios" <[email-masked]> writes:

> Since eshell-buffer-name is a variable, eval-when-compile is not the
> right thing to do here.  Instead, there should be a
> (defvar eshell-buffer-name) inside project-eshell declaring the symbol
> as special.  Right?

You are absolutely correct, and TIL - thanks :)

Below is another patch doing this. Works fine in emacs -Q

Theo

From 2c16ab87e369ab315d43d5e1d6965f1278c2c240 Mon Sep 17 00:00:00 2001
From: Theodor Thornhill <[email-masked]>
Date: Sun, 21 Jun 2020 19:15:37 +0200
Subject: [PATCH] Forward declare eshell-buffer-name in project-eshell

* lisp/progmodes/project.el: Forward declares 'eshell-buffer-name' so
that 'project-eshell' can use the special variable in eshell.
---
 lisp/progmodes/project.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 74495cf07a..715f0480bb 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -740,6 +740,7 @@ project-eshell
 With \\[universal-argument] prefix, create a new Eshell buffer
 with uniquified name."
   (interactive)
+  (defvar eshell-buffer-name)
   (let* ((default-directory (project-root (project-current t)))
          (eshell-buffer-name
            (concat "*" (file-name-nondirectory
-- 
2.27.0