unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Auto load at startup
@ 2003-10-13 14:43 Sébastien Kirche
  0 siblings, 0 replies; 3+ messages in thread
From: Sébastien Kirche @ 2003-10-13 14:43 UTC (permalink / raw)


Hi,
for auto-loading elisp libraries at startup from a custom directory,
I though it was necessary to add something like

(add-to-list 'load-path "~/.my_elisp_dir/")

but it seems like emacs don't care of subdirs of my_elisp_dir.
Thus I have errors at startup if I add some

(require 'package)

if the named package is in a subdir.

But i put inside my_elisp_dir a file subdirs.el that *sould* have load 
these packages ?

Also, i found the following in the emacswiki :

,----[ Including subdirectories ]
|
| By default Emacs doesn't include subdirectories of a directory
| which is added to load-path. But you can do it by issuing a command
| in startup file:
|
| (normal-top-level-add-subdirs-to-load-path)
|
| which will add all subdirs of current directory. Note: current 
directory
| is not necessary that one, where your script is executed at the 
moment.
| So you first need to change directory to required one:
|
| (progn (cd "~/elisp") (normal-top-level-add-subdirs-to-load-path))
|
| In this example assumed that you want to add all subdirs of ~/elisp 
directory.
`----

I tried this tip that seems to work, but I would like to understand why 
the subdirs.el fails/isn't sufficient.

Thanks for help
Sébastien Kirche

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Auto load at startup
       [not found] <mailman.1597.1066056301.21628.help-gnu-emacs@gnu.org>
@ 2003-10-13 17:43 ` Kevin Rodgers
  2003-10-14  8:43   ` Sébastien Kirche
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Rodgers @ 2003-10-13 17:43 UTC (permalink / raw)


Sébastien Kirche wrote:

> I tried this tip that seems to work, but I would like to understand why 
> the subdirs.el fails/isn't sufficient.

What exactly did you put in ~/.my_elisp_dir/subdirs.el that didn't work?


-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Auto load at startup
  2003-10-13 17:43 ` Auto load at startup Kevin Rodgers
@ 2003-10-14  8:43   ` Sébastien Kirche
  0 siblings, 0 replies; 3+ messages in thread
From: Sébastien Kirche @ 2003-10-14  8:43 UTC (permalink / raw)



Le lundi, 13 oct 2003, à 19:43 Europe/Paris, Kevin Rodgers a écrit :

>> I tried this tip that seems to work, but I would like to understand 
>> why the subdirs.el fails/isn't sufficient.
>
> What exactly did you put in ~/.my_elisp_dir/subdirs.el that didn't 
> work?

Well,
actually, i think after investigation that I could have fixed my 
problem.
It was mainly a mis-understand of behaviour of emacs about the 
load-path :
i first added the following in my .emacs :
,----
| (if (file-exists-p "~/.elisp/" )
|   (setq load-path (cons (concat "~/.elisp/" ) load-path))
| )
`----
and that subdirs.el in ~/.elisp :
,----
| (if (fboundp 'normal-top-level-add-subdirs-to-load-path)
|     (normal-top-level-add-subdirs-to-load-path))
`----

the lisp files that were in ~/.elisp were accessible, but i found that 
packages in subdirs were accessibles but not pre-loaded, that was what 
i mis-understood.

I corrected the following like this :
,----
| ; check either Emacs or XEmacs
| (defvar is-xemacs
|   (string-match "XEmacs" emacs-version)
|   "Variable interne differente de nil si on est dans XEmacs"
| )
|
| ; add my personal elisp directory to search path + preload
| (defvar my-elisp-path "~/.elisp" "Chemin vers mes packages elisp")
| (if is-xemacs
| 	(setq my-elisp-path (expand-file-name my-elisp-path))
| )
| (add-to-list 'load-path my-elisp-path)	
| (progn (cd my-elisp-path) (normal-top-level-add-subdirs-to-load-path))
`----
What do you think of that proposition ?

Thanks for any remark
Sébastien.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-10-14  8:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1597.1066056301.21628.help-gnu-emacs@gnu.org>
2003-10-13 17:43 ` Auto load at startup Kevin Rodgers
2003-10-14  8:43   ` Sébastien Kirche
2003-10-13 14:43 Sébastien Kirche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).