0

The question arises with connection to the problem of adding child dirs to the load-path. Here's a solution. Unfortunately - it seems to revert the load-path. I tried to fix it myself, but can't do and need help.

So my question is: how do I revert a load-path.

I tried (setq load-path (reverse load-path)) but it fails - which suggests that load-path is not a list...

Edit:

Reversing load path works, indeed - I don't know what I did wrong when I tried it before posting.

I'm facing a very strange problem simple.el shadows sunrise-commander.el - while it supposed to load before that. I thought - the problem is in the order in which I have dirs in a load path - but now - when I reversed the load-path - progmodes dir is before the sunrise one - the problem is still around. I'm puzzled.

I'll reformulate my question then: how do I make sure that a given extension is loading after the core Emacs's code?

Edit 2:

In case shadow doesn't mean, what I think - my actual problem is that many sunrise-commander and icicles keys are binded to core emacs functions. For example when I use icicles M-p is binded to

M-p runs the command recenter-top-bottom, which is an interactive
compiled Lisp function in `window.el'.

While it should be previous-history-element. Similarly, when I use sunrise-commander M-u is binded to

M-u runs the command subword-backward, which is an interactive
compiled Lisp function in `subword.el'.

while it realy should be sr-history-next.

Edit 3:

Oh I solved it! In the old days I used to install emacs things system-wide, thru synaptic package manager. Then I came with a resolution - that this way it is impossible to have my customizations with me. And after that I maintain a local emacs and emacs packages. So all I has to do is to remove all the system-wide emacs stuff.

** Edit 4**:

Nope it is not that. It way ErgoEmacs keybindings extension. After I commented it out I have M-n and M-p working fine in icicles. Though RET in Sunrise commander still calls dired function - not the sunrise one. Hopefully will solve it later.

Community
  • 1
  • 1
Adobe
  • 12,967
  • 10
  • 85
  • 126
  • 2
    Is there a typo between `revert` and `reverse` in this question? Otherwise, can you illustrate the issue. I don't get it. – pmr Mar 07 '12 at 11:54
  • 1
    there's a closing parenthesis missing in your post, is it a typo or maybe the explanation of your problem? Otherwise, `load-path` is a list and your expression should work (it does work for me). Maybe you could post more context: error message, current value of `load-path` (which you can obtain using `C-h v load-path` – François Févotte Mar 07 '12 at 11:58
  • 1
    As an aside, `nreverse` is worth knowing. – tripleee Mar 07 '12 at 12:34
  • I don't think shadow means what you seem to think it means. What is your actual problem? – event_jr Mar 07 '12 at 12:46

2 Answers2

2

Extensions are loaded by either require or load. The load-path simply specifies a list of folders in which require will search. Imagine you have the .emacs.d/vendor dir full of Emacs extensions and it's added to your load-path (the order of entries in the load path doesn't matter unless the same extension is in several of the folders there - something known as load-path shadowing, that can be examined with M-x list-load-path-shadows). You can do one of two things at this point:

(require 'extension)
;; or
(load "~/emacs.d/vendor/extension.el)

require has the added benefit, that it wouldn't load a library twice. So, to answer you question - to make sure that an extensions is loaded after the core (very few things are loaded automatically by Emacs) it just has to be required or loaded after the stuff you want it loaded after.

After you second edit I think you should take a look at this great article on keybindings in Emacs.

Bozhidar Batsov
  • 55,802
  • 13
  • 100
  • 117
  • +1 different modes have different key bindings, the M-u binding should only happen in a Sunrise buffer (or, more painfully, a buffer whose major mode uses the Sunrise keymap). – tripleee Mar 07 '12 at 13:35
  • Sunrise's buttons don't work for me in Sunrise. Not in text mode. Similarly In icicles - when I'm in minibuffer - M-n calls keyboard quit - which is seen in *messages*... I started all these load-path business out of hysteria. Actually I always thought that the placement of dirs in load-path doesn't matter. Thanks for reply anyway. Sunrise and Icicles got shadowed - even if I place the corresponding lines at the very end of my .emacs – Adobe Mar 07 '12 at 13:47
  • You should probably trim down your `.emacs` to only sunrise and icicles config to pinpoint the exact problem - frankly I don't understand the problems. It seems quite unlikely that a major or a minor mode would bind something to M-p or M-u and it would be some regular Emacs command instead of something from the mode... – Bozhidar Batsov Mar 07 '12 at 13:58
  • Please - see Edit 3 of the question. – Adobe Mar 07 '12 at 14:08
1

Not sure if it matters, but regarding "how do I load something before simple.el": you can't because simple.el is preloaded in the `emacs' executable, so it's loaded long before the .emacs is loaded.

Stefan
  • 101
  • 1