unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [nongnu] elpa/eat 64dcbd2c07: Fix recursive load error
       [not found] ` <20230703170037.5C229C11DC2@vcs2.savannah.gnu.org>
@ 2023-07-04  3:10   ` Stefan Monnier
  0 siblings, 0 replies; only message in thread
From: Stefan Monnier @ 2023-07-04  3:10 UTC (permalink / raw)
  To: emacs-devel; +Cc: Akib Azmain Turja

> 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)




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-04  3:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <168840363703.15967.5071736694173434331@vcs2.savannah.gnu.org>
     [not found] ` <20230703170037.5C229C11DC2@vcs2.savannah.gnu.org>
2023-07-04  3:10   ` [nongnu] elpa/eat 64dcbd2c07: Fix recursive load error Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).