emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [nongnu] elpa/eat 64dcbd2c07: Fix recursive load error


From: Stefan Monnier
Subject: Re: [nongnu] elpa/eat 64dcbd2c07: Fix recursive load error
Date: Mon, 03 Jul 2023 23:10:30 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

> diff --git a/eat.el b/eat.el
> index 8b17743906..8270f6fb25 100644
> --- a/eat.el
> +++ b/eat.el
> @@ -221,7 +221,9 @@ make the changes effective."
>           (when (and (not eat--being-loaded)
>                      (boundp 'eat-semi-char-mode-map))
>             (eat-update-semi-char-mode-map)
> -           (eat-reload)))
> +           (let ((after-load-alist nil)
> +                 (after-load-functions nil))
> +             (eat-reload))))
>    :group 'eat-ui)
>  
>  (defcustom eat-eshell-semi-char-non-bound-keys
> @@ -267,7 +269,9 @@ Eat to make the changes effective."
>           (when (and (not eat--being-loaded)
>                      (boundp 'eat-eshell-semi-char-mode-map))
>             (eat-eshell-update-semi-char-mode-map)
> -           (eat-reload)))
> +           (let ((after-load-alist nil)
> +                 (after-load-functions nil))
> +             (eat-reload))))
>    :group 'eat-eshell)
>  
>  (defcustom eat-enable-directory-tracking t

Hmm... 2 questions:

- Why not do the let-binding inside `eat-reload` so you do it at one
  place instead of two?
- Why `eat-reload` at all?  This is highly unusual and likely to bump
  into all kinds of odd corner cases for that reason.
  Wouldn't you be better served with a (re)initialization function which
  you can then call without having to reload any file?

I include a not-really-related patch below for ... completeness?


        Stefan


diff --git a/eat.el b/eat.el
index 8b17743906..a2ce661c48 100644
--- a/eat.el
+++ b/eat.el
@@ -540,11 +540,10 @@ This value is used by terminal programs to identify the 
terminal."
 ;; Upgrading Eat causes `eat-term-terminfo-directory' and
 ;; `eat-term-shell-integration-directory' to be outdated, so update it
 ;; if not modified by user (or something else).
-(defvar eat--load-file-path nil
-  "Path to currently loaded Eat.")
 
-(defvar eat--install-path nil
-  "Path to directory where Eat is installed.")
+;; FIXME: The GNU convention used in Emacs is for "path" to mean a list of
+;; directories (as in `load-path' or $PATH), so these should be called
+;; "file names".
 
 (defvar eat--terminfo-path nil
   "Path to directory where Terminfo databases are installed.")
@@ -552,10 +551,13 @@ This value is used by terminal programs to identify the 
terminal."
 (defvar eat--shell-integration-path nil
   "Path to directory where shell integration scripts are installed.")
 
-(setq eat--load-file-path (or load-file-name buffer-file-name))
+(defconst eat--load-file-path
+  (if (fboundp 'macroexp-file-name) (macroexp-file-name)
+    (or load-file-name buffer-file-name))
+  "Path to currently loaded Eat.")
 
-(setq eat--install-path
-      (copy-sequence (file-name-directory eat--load-file-path)))
+(defconst eat--install-path (file-name-directory eat--load-file-path)
+  "Path to directory where Eat is installed.")
 
 (defvar eat-term-terminfo-directory)
 (defvar eat-term-shell-integration-directory)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]