问题
I'm using the Edwin editor with MIT-scheme, and because the default font size is so small, I do M-x set-font
and then choose
-adobe-courier-bold-r-normal--24-240-75-75-m-150-iso8859-1
to make the font bigger. This works fine, but when I try to put
(set-font "-adobe-courier-bold-r-normal--24-240-75-75-m-150-iso8859-1")
in my ~/.edwin
, it complains about Unbound variable: set-font
.
In emacs, interactive functions from M-x
can usually be straightforwardly called programmatically in Elisp, but apparently not so here. I tried reading more about how to customize Edwin by looking at the manual with `info mit-scheme-user', but the Edwin chapter specifically says
This manual does not discuss customization of Edwin.
How do I call set-font
programmatically?
回答1:
Apparently, Edwin commands are not procedures, and cannot be called directly in Scheme code. However, a simple fix enables this, simply wrap it with the ref-command
macro:
`((ref-command set-font) "-adobe-courier-bold-r-normal--24-240-75-75-m-150-iso8859-1")`
Source: A 1997 mailing list thread with this exact same question
Edwin commands aren't procedures (unlike GNU Emacs). An Edwin command is a special object with an unusual name. If you want to invoke a command from a program you must use the REF-COMMAND macro. For example, to start a shell buffer as if you had typed "M-x shell":
((ref-command shell) #t)
来源:https://stackoverflow.com/questions/59449897/how-to-programmatically-call-m-x-functions-in-edwin-for-mit-scheme