/[guile]/guile/guile-core/lang/elisp/internals/load.scm
ViewVC logotype

Diff of /guile/guile-core/lang/elisp/internals/load.scm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by ossau, Fri Oct 26 16:42:43 2001 UTC revision 1.2 by ossau, Tue Jan 22 23:46:01 2002 UTC
# Line 0  Line 1 
1    (define-module (lang elisp internals load)
2      #:use-module (ice-9 optargs)
3      #:use-module (lang elisp internals signal)
4      #:use-module (lang elisp internals format)
5      #:use-module (lang elisp internals evaluation)
6      #:export (load-path
7                load))
8    
9    (define load-path '("/usr/share/emacs/20.7/lisp/"
10                        "/usr/share/emacs/20.7/lisp/emacs-lisp/"))
11    
12    (define* (load file #:optional noerror nomessage nosuffix must-suffix)
13      (define (load1 filename)
14        (let ((pathname (let loop ((dirs (if (char=? (string-ref filename 0) #\/)
15                                             '("")
16                                             load-path)))
17                          (cond ((null? dirs) #f)
18                                ((file-exists? (string-append (car dirs)
19                                                              filename))
20                                 (string-append (car dirs) filename))
21                                (else (loop (cdr dirs)))))))
22          (if pathname
23              (begin
24                (or nomessage
25                    (message "Loading %s..." pathname))
26                (with-input-from-file pathname
27                  (lambda ()
28                    (let loop ((form (read)))
29                      (or (eof-object? form)
30                          (begin
31                            ;; Note that `eval' already incorporates use
32                            ;; of the specified module's transformer.
33                            (eval form the-elisp-module)
34                            (loop (read)))))))
35                (or nomessage
36                    (message "Loading %s...done" pathname))
37                #t)
38              #f)))
39      (or (and (not nosuffix)
40               (load1 (string-append file ".el")))
41          (and (not must-suffix)
42               (load1 file))
43          noerror
44          (signal 'file-error
45                  (list "Cannot open load file" file))))

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26