Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In emacs who is setting Info-directory-list when including packages?

I recently switched to the use of emacs' package manager packages.

Since then, some emacs path variables get set beyond what I do in my .emacs file: Both load-path and Info-directory-list get perpended with stuff from the packages. But I don't understand where these customisations are done.

Let's concentrate on Info-directory-list: In my .emacs file I don't set it so it should be nil (so that later when info starts up, its initialised from Info-default-directory-list. However with my new packaging it is already intialised and some package directories are added. This messes up my dir structure in info. I have checked the autoload files, but they don't set Info-directory-list in any way - and no other elisp file in the packages (pandoc-mode in particular) do so.

Where is the Info-directory-list variable set and how can I regain control over the order in this variable?

like image 855
halloleo Avatar asked Oct 20 '22 23:10

halloleo


1 Answers

After evaluating your init file, Emacs calls package-initialize (which does what it sounds like). After initializing the packages, Emacs runs after-init-hook, so if you want to manipulate variables which have been modified during package initialisation, you can put the following in your init file:

(add-hook 'after-init-hook 'my-after-init-hook)
(defun my-after-init-hook ()
  "After package initialisation."
  ;; do something with Info-directory-list
  )

You can also call package-initialize yourself, provided that you ensure that any necessary package-related variables are set beforehand. See Emacs 24 Package System Initialization Problems for details.

As for how and why Info-directory-list is being modified, the manual comments on that aspect in (elisp) Multi-file Packages:

A multi-file package is less convenient to create than a single-file package, but it offers more features: it can include multiple Emacs Lisp files, an Info manual, and other file types (such as images).

[...]

If the content directory contains a file named dir, this is assumed to be an Info directory file made with install-info. *Note Invoking install-info: (texinfo)Invoking install-info. The relevant Info files should also be present in the content directory. In this case, Emacs will automatically add the content directory to Info-directory-list when the package is activated.

Specifically, package-activate-1 does this:

(when (file-exists-p (expand-file-name "dir" pkg-dir))
      ;; FIXME: not the friendliest, but simple.
      (require 'info)
      (info-initialize)
      (push pkg-dir Info-directory-list))
like image 177
phils Avatar answered Oct 27 '22 17:10

phils