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)
9 (define load-path '("/usr/share/emacs/20.7/lisp/"
10 "/usr/share/emacs/20.7/lisp/emacs-lisp/"))
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) #\/)
17 (cond ((null? dirs) #f)
18 ((file-exists? (in-vicinity (car dirs) filename))
19 (in-vicinity (car dirs) filename))
20 (else (loop (cdr dirs)))))))
24 (message "Loading %s..." pathname))
25 (with-input-from-file pathname
27 (let loop ((form (read)))
28 (or (eof-object? form)
30 ;; Note that `eval' already incorporates use
31 ;; of the specified module's transformer.
32 (eval form the-elisp-module)
35 (message "Loading %s...done" pathname))
38 (or (and (not nosuffix)
39 (load1 (string-append file ".el")))
40 (and (not must-suffix)
44 (list "Cannot open load file" file))))