Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency in the definition of ess-lisp-directory and ess-dir #1293

Open
plantarum opened this issue May 15, 2024 · 0 comments
Open

Inconsistency in the definition of ess-lisp-directory and ess-dir #1293

plantarum opened this issue May 15, 2024 · 0 comments

Comments

@plantarum
Copy link
Contributor

Apologies for this very trivial 'issue'. It's probably only relevant to my unusual use case, where I'm 'installing' ESS (from source) into my .emacs.d/ directory, rather than the usual places (i.e., via elpa, or in /usr/emacs/site-lisp).

The variable ess-lisp-directory is defined in ess-custom.el:

ESS/lisp/ess-custom.el

Lines 137 to 140 in d941b25

(defcustom ess-lisp-directory
(file-name-directory
(or load-file-name
buffer-file-name))

Using file-name-directory should always return a directory, which in my case is "/home/smithty/.emacs.d2/repos/ess/lisp/" (note the trailing /).

When that string is used to define ess-dir in ess.el:

ESS/lisp/ess.el

Lines 87 to 88 in d941b25

(defun ess-version-string ()
(let* ((ess-dir (file-name-directory ess-lisp-directory)) ; if(<from source>) the top-level 'ess/'

it is passed on to file-name-directory again. When file-name-directory receives a directory, it returns the same directory. In this case I think the intention is to return the parent directory of ess-lisp-directory, so this is an error. The consequence is that when I call ess-version I get the following message:

ess-version:  [<unknown>] (loaded from /home/smithty/.emacs.d2/repos/ess/lisp/)

I think this can be corrected by coercing ess-lisp-directory to a directory file name:

(defun ess-version-string ()
  (let* ((ess-dir (file-name-directory
                   (directory-file-name ess-lisp-directory))) ; if(<from source>) the top-level 'ess/'

With this change, I get the correct value from ess-version:

ess-version:  [git: d941b25f10716c307f546bdd9cb85d4ac5c1cf38] (loaded from /home/smithty/.emacs.d2/repos/ess/lisp/)

Since this doesn't actually change the value of ess-lisp-directory, and ess-dir is local to the function ess-version-string, I don't think it should break anything.

I'm a little embarrassed to raise such a trivial issue. Really I just want to make sure I'm installing ESS properly, in the event that I'm then able to contribute anything of more substance in future.

In any case, if this makes sense I could make a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant