Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

el-get-set-info-path incorrect in recent Emacs #814

Closed
orivej opened this Issue · 11 comments

3 participants

@orivej

This eval-after-load no longer executes in Emacs from VCS as "paths.el" is not present anymore:

(defun el-get-set-info-path (package infodir-rel)
  (eval-after-load "paths"
    '(el-get-add-path-to-list package 'Info-default-directory-list infodir-rel)))

As per dc60169, the rationale is to "Avoid loading info.el when adding paths to Info-directory-list. Instead, use the variable Info-default-directory-list, which is defined in paths.el." Now this variable is defined in "info.el".

@DamienCassou DamienCassou referenced this issue from a commit in DamienCassou/el-get
@DamienCassou DamienCassou Make `el-get-set-info-path' compatible with the most recent Emacs
Fix github issue #814: "el-get-set-info-path incorrect in recent Emacs"

Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
0d400e5
@DamienCassou

Attached pull request fixes this issue by calling eval-after-load on both "paths" and "info", one after the other. Thanks to Nic Ferrier for the suggestion.

@DamienCassou DamienCassou referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@orivej

Thank you for the fix, but it does not seem to be enough. 'Info-directory-list somehow gets initialized from 'Info-default-directory-list before #'el-get-add-path-to-list from eval-after-load is called (even though a call to #'el-get is the first in my Emacs init file). Because of this, setting 'Info-default-directory-list has no effect. It is inconsistent with the documentation string for #'el-get which says that el-get ensures that ~"Info-directory-list is set so that info files can be found".

My fix is to reset 'Info-directory-list to 'nil:

(defun el-get-set-info-path (package infodir-rel)
  (let ((body
         `(progn
            (setq Info-directory-list nil)
            (el-get-add-path-to-list
             ',package 'Info-default-directory-list ,infodir-rel))))
    ;; `Info-default-directory-list' is defined in "paths.el" until 24.1
    ;; and in "info.el" in more recent Emacs versions.
    (eval-after-load "paths" body)
    (eval-after-load "info" body)))

It contradicts #'el-get documentation, but documentation for 'Info-directory-list says that 'nil means unitialized and the variable gets initialized by #'info-initialize whenever needed.

Note that setting 'Info-default-directory-list has no effect even with the fix unless INFOPATH environment variable is empty or ends with the colon sign. I think this should be reflected in #'el-get docstring.

@DamienCassou

Things are working fine for me in an Emacs built 3 days ago.

@orivej

Your INFOPATH environment variable is unset. When it is set, even "emacs -q" initializes 'Info-directory-list. Try "INFOPATH=/usr/share/info emacs".

I think that the following better agrees with the intent of the commit dc60169 and works in any supported version of Emacs. It also agrees with the documentation for #'el-get.

(defun el-get-set-info-path (package infodir-rel)
  (eval-after-load "info"
    `(el-get-add-path-to-list ',package 'Info-directory-list ,infodir-rel)))

'Info-default-directory-list is hardly meant for customization. For examle, without my earlier fix, info files installed during Emacs session would not get listed in the virtual info directory until restart.

@orivej orivej closed this
@orivej orivej reopened this
@DamienCassou

Adding to Info-directory-list does not work for me either because in this case only the info files handled by el-get are accessible. According to the Emacs documentation of this variable this is normal as any value in this variable prevents Emacs from using Info-default-directory-list' value as an initial value forInfo-directory-list'.

I thought about using Info-additional-directory-list' instead, but this variable is searched afterInfo-directory-list'. This means that system-wide packages now take precedence over el-get ones. Which is probably not what we want.

@orivej

Then this works:

(defun el-get-set-info-path (package infodir-rel)
  (eval-after-load "info"
    `(progn
       (info-initialize)
       (el-get-add-path-to-list ',package 'Info-directory-list ,infodir-rel))))
@DamienCassou

This is exactly what commit dc60169 tried to avoid if I understood correctly :-)

@orivej

No, it tried to avoid loading info.el, i.e. (require 'info). I'm curious, why. (It was not automatically loaded in Emacs 23; hence, 'Info-default-directory-list outside info.el. Emacs 24.1 loads it at startup.)

According to C-h i g "(elisp) Hooks for Loading",

Normally, well-designed Lisp programs should not use 'eval-after-load'. If you need to examine and set the variables defined in another library (those meant for outside use), you can do it immediately—there is no need to wait until the library is loaded. If you need to call functions defined by that library, you should load the library, preferably with 'require'.

From this I deduce that it is more appropriate to (require 'info) together with other requires, (info-initialize) in #'el-get and let el-get-set-info-path be

(defun el-get-set-info-path (package infodir-rel)
  (el-get-add-path-to-list package 'Info-directory-list infodir-rel))
@DamienCassou

I've just contact the author of commit dc60169 privately because he has no github account. Rafael believes that your solution on comment #814 (comment) is the correct one.

@DamienCassou DamienCassou referenced this issue from a commit in DamienCassou/el-get
@DamienCassou DamienCassou Fix el-get issue #814 about setting `Info-directory-list'
Signed-off-by: Damien Cassou <damien.cassou@gmail.com>

Conflicts:

	el-get-build.el

Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
551d7cd
@DamienCassou

In this pull request I chose your fix in #814 (comment) because it's the simplest. Your more recent comment requires modifying 3 locations in 2 files and always load info even when users don't use it.

@orivej

I have not learned from this discussion as much as I hoped; yet thank you for submitting patches upstream.

@pasja pasja referenced this issue from a commit in pasja/el-get
@DamienCassou DamienCassou Make `el-get-set-info-path' compatible with the most recent Emacs
Fix github issue #814: "el-get-set-info-path incorrect in recent Emacs"

Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
06411b0
@pasja pasja referenced this issue from a commit in pasja/el-get
@DamienCassou DamienCassou Fix el-get issue #814 about setting `Info-directory-list'
Signed-off-by: Damien Cassou <damien.cassou@gmail.com>

Conflicts:

	el-get-build.el

Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
adfae36
@dimitri dimitri closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.