* Babel Forth
@ 2025-01-22 20:41 Thomas S. Dye
2025-01-23 8:16 ` Joost Kremers
0 siblings, 1 reply; 3+ messages in thread
From: Thomas S. Dye @ 2025-01-22 20:41 UTC (permalink / raw)
To: emacs-orgmode
Aloha all,
I'm drafting ob-doc-forth.org and haven't been able to get
ob-forth.el to recognize a working GForth in Spacemacs. I get
"Symbol's function definition is void: forth-proc" when I evaluate
a Forth source block.
In ob-forth.el there is this: (declare-function forth-proc
"ext:gforth" ())
My hunch is that the ext: part of ext:gforth expects that
forth-mode is setup to use the forth-mode distributed with GForth.
Spacemacs appears to use forth-mode from Elpa, instead, and I find
forth-mode.el in the elpa subdirectory of my Spacemacs.
I don't program in Forth and given my limited grasp of elisp, I
don't look forward to debugging this just to draft some
documentation, so I'd like to ask for help.
Have I diagnosed the problem correctly?
If so, could ob-forth.el be patched to enable all Emacs
users--plain, Spacemacs, Doom, Prelude, Scimax, etc.--to evaluate
Forth code blocks? Or, should ob-doc-forth give instructions how
to setup forth-mode to use the one distributed with GForth?
What is the best way forward here?
All the best,
Tom
--
Thomas S. Dye
https://tsdye.online/tsdye
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Babel Forth
2025-01-22 20:41 Babel Forth Thomas S. Dye
@ 2025-01-23 8:16 ` Joost Kremers
2025-01-23 8:22 ` Joost Kremers
0 siblings, 1 reply; 3+ messages in thread
From: Joost Kremers @ 2025-01-23 8:16 UTC (permalink / raw)
To: Thomas S. Dye; +Cc: emacs-orgmode
On Wed, Jan 22 2025, Thomas S. Dye wrote:
> Aloha all,
>
> I'm drafting ob-doc-forth.org and haven't been able to get ob-forth.el to
> recognize a working GForth in Spacemacs. I get "Symbol's function
> definition is void: forth-proc" when I evaluate a Forth source block.
>
> In ob-forth.el there is this: (declare-function forth-proc "ext:gforth" ())
>
> My hunch is that the ext: part of ext:gforth expects that forth-mode is
> setup to use the forth-mode distributed with GForth.
No. `declare-function` doesn't do anything except silence the
byte-compiler. It's used when you use a function in your Elisp source that
may not be loaded into your running Emacs session while editing the .el
file. In such a case, the byte compiler cannot find the function, so it
issues a warning. With `declare-function`, you tell the byte compiler where
to look for the function. The prefix "ext:" indicates that the file is an
external file (i.e., doesn't come with Emacs), so it may not even be found
at all, and that if that happens, the byte compiler still shouldn't complain.
The important thing to note is that `declare-function` doesn't make the
function available for *running* the code, it really is meant *just* for
the byte compiler. To make sure `gforth.el` is loaded, you need to use a
`require` in your source code.
> Spacemacs appears to
> use forth-mode from Elpa, instead, and I find forth-mode.el in the elpa
> subdirectory of my Spacemacs.
The `declare-function` call says that `forth-proc` can be found in
`gforth.el`, so the fact that you have `forth-mode.el` installed is
(probably) irrelevant. What you need is the file `gforth.el`. Where it
comes from is irrelevant, it just needs to be on Emacs' `load-path`. (And
it needs to actually provide `forth-proc`, of course, and make it
autoloadable, but I assume that's the case.)
What I don't understand, though, is why there's no `(require 'gforth)` in
`ob-forth.el`. It seems that `forth-proc` is essential for running Forth
source blocks, so a `require` seems in order.
The point is that `declare-function` is usually only used to declare
functions that are optional, meaning that `ob-forth.el` should check if
it's available and gracefully handle the case where it's not.
> What is the best way forward here?
What does the documentation for `ob-forth.el` say? Does it say `gforth.el`
needs to be installed? Otherwise perhaps ask the Org mailing list or the
ob-forth maintainer directly?
--
Joost Kremers
Life has its moments
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Babel Forth
2025-01-23 8:16 ` Joost Kremers
@ 2025-01-23 8:22 ` Joost Kremers
0 siblings, 0 replies; 3+ messages in thread
From: Joost Kremers @ 2025-01-23 8:22 UTC (permalink / raw)
To: Thomas S. Dye; +Cc: emacs-orgmode
On Thu, Jan 23 2025, Joost Kremers wrote:
> On Wed, Jan 22 2025, Thomas S. Dye wrote:
>> What is the best way forward here?
>
> What does the documentation for `ob-forth.el` say? Does it say `gforth.el`
> needs to be installed? Otherwise perhaps ask the Org mailing list
Oh, silly me, this *is* the Org mailing list... :D I thought I was still
reading help-gnu-emacs...
--
Joost Kremers
Life has its moments
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-23 8:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-22 20:41 Babel Forth Thomas S. Dye
2025-01-23 8:16 ` Joost Kremers
2025-01-23 8:22 ` Joost Kremers
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).