Skip to content

Commit

Permalink
Dynamically infer essr version when essr-version is nil
Browse files Browse the repository at this point in the history
  When ESS is installed from MELPA essr-version is not set
  #1163 (comment)
  • Loading branch information
vspinu committed Jan 31, 2022
1 parent c59d8c1 commit 3252396
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 6 additions & 1 deletion lisp/ess-r-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,12 @@ 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))))
(or (with-temp-message "Fetching and loading ESSR into the remote ..."
(ess-boolean-command (format loader essr-version)))
(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))))
(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
4 changes: 1 addition & 3 deletions lisp/ess.el
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,17 @@

(require 'ess-utils)
(require 'cl-generic)

(require 'lisp-mnt)
(defvar reporter-prompt-for-summary-p)


;; Versions

(defconst ess-version (eval-when-compile
(require 'lisp-mnt)
(lm-version (or load-file-name buffer-file-name)))
"Version of ESS currently loaded.")

(defconst essr-version (eval-when-compile
(require 'lisp-mnt)
(lm-with-file (or load-file-name buffer-file-name)
(lm-header "ESSR-Version")))
"Version of ESSR package.")
Expand Down

0 comments on commit 3252396

Please sign in to comment.