How to load all the lisp files below ~/.xyzzy.d/ on xyzzy

Asked 2 years ago, Updated 2 years ago, 119 views

~/.xyzy.d To load all the lisp files under at startup

 (mapcar#'mc-load-file(directory"~/.xyzzy.d/":absolute:wild"*.l"))

I wrote that, but when I tried using xyzzy for the first time in a while, it stopped loading.
C-x C-e ran the line and it ended with (tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt

It also appears to have finished loading as well as running (directory"~/.xyzy.d/":absolute:wild"*.l")(mapcar#'mc-load-file list) argument.

I deleted and checked the dump file before I worked on it, and the xyzzy version uses 0.2.2.252.

Why can't I load properly?

About a month ago, I asked an external Q&A service Teratail, but I didn't get a reply, so I'm asking again.
https://teratail.com/questions/4565

January 16, 2015 Additional

If you create ~/.xyzy.d/foo.l and describe it below, the dialog box error! appears, but the function could not be found as M-xfoo.Has the function declared once been disabled?

 (defun foo()
  (interactive)
  (message "foo!!)")
  )
(error "error!")

common-lisp lisp xyzzy

2022-09-29 22:41

3 Answers

If (error "error!") of foo.l is running, the command function foo is
It may have been defined in another package that is not a user package.
M-x allows you to launch the command with the Package Qualifier Nassi:

  • Command functions exported from the user package using-package (lisp and editor in initial state)
  • Command functions defined in the user package

In other words, it is limited to command functions that are bound to symbols that are accessible from the user package in a package qualifier.

For example, bar.l and

 (in-package:user)
(defunbar()
  (interactive)
  (message "bar")

Suppose you have baz.l

 (defun baz()
  (interactive)
  (message "baz")

Write the code to load in .xyzzy as follows:

 (in-package:editor)
(require "bar")
(require "baz")

The function bar is defined in the user package, so you can launch it with M-xbar, but
The function baz will be defined in the current package editor, so
You must enter M-xed::baz to boot.
(Current package specification in the in-package function is valid in the currently loaded file.)

ed:: If you want to define it in the editor package but want to boot to pear,

 (in-package:editor)
(export'(baz))

(defun baz()
  (interactive)
  (message "baz")

You must export the symbol baz from the editor package by writing as shown in .

Therefore, please check if the current package has been changed to something other than user before the desired file is loaded in .xyzzy.
(I think the first current package of .xyzy was the user package regardless of the contents of siteinit.l.)

Also, it is recommended that the file to be loaded from the initialization file be packaged with the in-package function at the beginning of the file so that it is not affected by the current package from which it is loaded.


2022-09-29 22:41

I checked with xyzzy 0.2.2.252 and found that the following code reads .xyzzy.d/ files.

 (mapcar#'mc-load-file(directory"~/.xyzzy.d/":absolute:wild"*.l"))

I don't know the cause, so I'd like to suggest only how to isolate the problem.

In the initialization file, click

 (error "initialization file!!)")

Write and launch xyzzy.
If the initialization file does not appear here, the initialization file will not be loaded.

If this is OK, delete the error code and
Then create a file named foo.l below .xyzzy.d and

 (error "foo!!)")

If you start xyzzy and you don't see foo!!, it's not loaded, it's loaded when you get out.

In this way, the only way to do this is to write an error in the file you want to load and see how far you're loading it.


2022-09-29 22:41

This is not the answer, but I looked at the relevant part of the lisp file.

xyzzy/lisp/misc.l

 (defun mc-load-file (filename & optional encoding)
                   :
  (ed: save-excursion
    (setq buffer(ed:create-new-buffer"*load file*")
    (ed: set-buffer buffer)
    (let(ed:*expected-fileio-encoding*)
            (or encoding)
              (ed::find-file-auto-encoding filename)
              ed : *expected-fileio-encoding*)))
      (declare(special ed:*expected-fileio-encoding*))
      (ed:message"~A~A..."loading filename)
      (ed: insert-file-contents filename )
      (load(ed:make-buffer-stream buffer): verbose nil)
      (ed:message"~A~A...done" loading filename))
  (when buffer)
    (ed: delete-buffer buffer)))

There is (ed:message...) before and after load, but if LOADING... appears in the xyzzy mini buffer, the load should be running.If loading... is displayed in lowercase letters, it means that the byte compiled list file (*.lc) is loaded.


2022-09-29 22:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.