Skip to content

Commit

Permalink
Rely on load-true-file-name if exists for version retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
vspinu committed Feb 1, 2022
1 parent 3252396 commit 5ff4fa8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
14 changes: 7 additions & 7 deletions lisp/ess-r-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1552,14 +1552,14 @@ environment from GitHub and attaches it to the search path. If
the file already exists on disk from a previous download then the
download step is omitted. This function returns t if the ESSR
load is successful, and nil otherwise."
(let ((loader (ess-file-content (expand-file-name "ESSR/LOADREMOTE" ess-etc-directory))))
(let ((loader (ess-file-content (expand-file-name "ESSR/LOADREMOTE" ess-etc-directory)))
(essr (or essr-version
;; FIXME: Hack: on MELPA essr-version is not set
(lm-with-file (expand-file-name "ess.el" ess-lisp-directory)
(lm-header "ESSR-Version"))
(error "`essr-version' could not be automatically inferred from ess.el file"))))
(or (with-temp-message "Fetching and loading ESSR into the remote ..."
(let ((essr (or essr-version
;; FIXME: Hack: on MELPA essr-version is not set
(lm-with-file (expand-file-name "ess.el" ess-lisp-directory)
(lm-header "ESSR-Version"))
(error "`essr-version' could not be automatically inferred from ess.el file"))))
(ess-boolean-command (format loader essr-version))))
(ess-boolean-command (format loader essr)))
(let ((errmsg (with-current-buffer " *ess-command-output*" (buffer-string))))
(message (format "Couldn't load or download ESSR.rds on the remote.\n Error: %s\n Injecting local copy of ESSR." errmsg))
nil))))
Expand Down
10 changes: 8 additions & 2 deletions lisp/ess.el
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,17 @@
;; Versions

(defconst ess-version (eval-when-compile
(lm-version (or load-file-name buffer-file-name)))
(lm-version (or (and (boundp 'load-true-file-name)
load-true-file-name)
load-file-name
buffer-file-name)))
"Version of ESS currently loaded.")

(defconst essr-version (eval-when-compile
(lm-with-file (or load-file-name buffer-file-name)
(lm-with-file (or (and (boundp 'load-true-file-name)
load-true-file-name)
load-file-name
buffer-file-name)
(lm-header "ESSR-Version")))
"Version of ESSR package.")

Expand Down

0 comments on commit 5ff4fa8

Please sign in to comment.