unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to load a lisp file automatically
@ 2003-12-11 19:34 Chunyan Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Chunyan Wang @ 2003-12-11 19:34 UTC (permalink / raw)
  Cc: Erica Wang

hi, all,

I am sorry for the mass mailing.  I can use commands "M-x load-file
~/setnu.elc" that loads the lisp file into emacs.  My question is how to
load a lisp file automatically every time emacs is used.  I have compiled
the setnu.el lisp file into .elc file and have both of the files under my
home directory.

Here are the code that I added to .emacs file:

(setq load-path (cons "~/" load-path))
(require 'setnu)
(add-hook 'text-mode-hook 'turn-on-setnu-mode)

Thanks in advance for your time.


Erica Wang
331789 GaTech Station, Atlanta, GA 30332
Email: gte274s@prism.gatech.edu

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

* Re: How to load a lisp file automatically
       [not found] <mailman.1601.1071175004.399.help-gnu-emacs@gnu.org>
@ 2003-12-11 20:17 ` Kin Cho
  2003-12-12 12:47   ` Joakim Hove
  0 siblings, 1 reply; 3+ messages in thread
From: Kin Cho @ 2003-12-11 20:17 UTC (permalink / raw)


> (setq load-path (cons "~/" load-path))
> (require 'setnu)
> (add-hook 'text-mode-hook 'turn-on-setnu-mode)

Try adding to the bottom of setnu.el (and byte-compile it again):

(provide 'setnu)

-kin

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

* Re: How to load a lisp file automatically
  2003-12-11 20:17 ` How to load a lisp file automatically Kin Cho
@ 2003-12-12 12:47   ` Joakim Hove
  0 siblings, 0 replies; 3+ messages in thread
From: Joakim Hove @ 2003-12-12 12:47 UTC (permalink / raw)



Kin Cho <kin@techie.com> writes:

>> (setq load-path (cons "~/" load-path))
>> (require 'setnu)
>> (add-hook 'text-mode-hook 'turn-on-setnu-mode)
>
> Try adding to the bottom of setnu.el (and byte-compile it again):
>
> (provide 'setnu)

An another solution (it is always a good idea to (provide
'your-lisp)), but instead of (require 'setnu) you could use:

  (autoload 'turn-on-setnu-mode "setnu" "Automatically load file setnu" 't)

The purpose of this is to setup a connection between a function
(turn-on-setnu-mode), and a file ("setnu.el(c)") which contains an
implementation of that function.

HTH - Joakim

-- 
  /--------------------------------------------------------------------\
 / Joakim Hove  / hove@bccs.no  /  (55 5) 84076       |                 \
 | Unifob AS, Avdeling for Beregningsvitenskap (BCCS) | Stabburveien 18 |
 | CMU                                                | 5231 Paradis    |
 \ Thormøhlensgt.55, 5020 Bergen.                     | 55 91 28 18     /
  \--------------------------------------------------------------------/

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

end of thread, other threads:[~2003-12-12 12:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1601.1071175004.399.help-gnu-emacs@gnu.org>
2003-12-11 20:17 ` How to load a lisp file automatically Kin Cho
2003-12-12 12:47   ` Joakim Hove
2003-12-11 19:34 Chunyan Wang

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).