Skip to content

Commit 5ff4fa8

Browse files
committed
Rely on load-true-file-name if exists for version retrieval
1 parent 3252396 commit 5ff4fa8

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

lisp/ess-r-mode.el

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,14 +1552,14 @@ environment from GitHub and attaches it to the search path. If
15521552
the file already exists on disk from a previous download then the
15531553
download step is omitted. This function returns t if the ESSR
15541554
load is successful, and nil otherwise."
1555-
(let ((loader (ess-file-content (expand-file-name "ESSR/LOADREMOTE" ess-etc-directory))))
1555+
(let ((loader (ess-file-content (expand-file-name "ESSR/LOADREMOTE" ess-etc-directory)))
1556+
(essr (or essr-version
1557+
;; FIXME: Hack: on MELPA essr-version is not set
1558+
(lm-with-file (expand-file-name "ess.el" ess-lisp-directory)
1559+
(lm-header "ESSR-Version"))
1560+
(error "`essr-version' could not be automatically inferred from ess.el file"))))
15561561
(or (with-temp-message "Fetching and loading ESSR into the remote ..."
1557-
(let ((essr (or essr-version
1558-
;; FIXME: Hack: on MELPA essr-version is not set
1559-
(lm-with-file (expand-file-name "ess.el" ess-lisp-directory)
1560-
(lm-header "ESSR-Version"))
1561-
(error "`essr-version' could not be automatically inferred from ess.el file"))))
1562-
(ess-boolean-command (format loader essr-version))))
1562+
(ess-boolean-command (format loader essr)))
15631563
(let ((errmsg (with-current-buffer " *ess-command-output*" (buffer-string))))
15641564
(message (format "Couldn't load or download ESSR.rds on the remote.\n Error: %s\n Injecting local copy of ESSR." errmsg))
15651565
nil))))

lisp/ess.el

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,17 @@
5858
;; Versions
5959

6060
(defconst ess-version (eval-when-compile
61-
(lm-version (or load-file-name buffer-file-name)))
61+
(lm-version (or (and (boundp 'load-true-file-name)
62+
load-true-file-name)
63+
load-file-name
64+
buffer-file-name)))
6265
"Version of ESS currently loaded.")
6366

6467
(defconst essr-version (eval-when-compile
65-
(lm-with-file (or load-file-name buffer-file-name)
68+
(lm-with-file (or (and (boundp 'load-true-file-name)
69+
load-true-file-name)
70+
load-file-name
71+
buffer-file-name)
6672
(lm-header "ESSR-Version")))
6773
"Version of ESSR package.")
6874

0 commit comments

Comments
 (0)