Comments (5)
https://www.emacswiki.org/emacs/Forth-mode works pretty well
from discussion.
Welcome @timmyjose. I also use the Emacs Forth Mode, as I was working with @MitchBradley's source and it just made sense to stick to the same indentation. But I was and keep using it in my unpublished work. I also have some customisations in .emacs
;
(add-to-list 'auto-mode-alist '("\\.fth$" . forth-mode))
(add-to-list 'auto-mode-alist '("\\.bth$" . forth-mode))
(add-hook 'forth-mode-hook (function (lambda ()
(setq forth-indent-level 3)
(setq forth-minor-indent-level 1)
(setq forth-hilight-level 3))))
from discussion.
My set of customizations is a bit more extensive that that of my good friend @quozl . To wit:
(defvar GFORTH_EL (concat HOME "/lisp/gforth.el"))
(cond ((file-readable-p GFORTH_EL)
(load-library GFORTH_EL)
(autoload 'forth-mode GFORTH_EL)
(setq auto-mode-alist (cons '("\\.fth\\'" . forth-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.bth\\'" . forth-mode) auto-mode-alist))
(autoload 'forth-block-mode GFORTH_EL)
(setq auto-mode-alist (cons '("\\.fb\\'" . forth-block-mode) auto-mode-alist))
(add-hook 'forth-mode-hook (function (lambda ()
(setq forth-indent-level 3)
(setq forth-minor-indent-level 2)
(setq forth-hilight-level 3)
(setq forth-custom-words
'(
(("label") non-immediate (font-lock-keyword-face . 1)
"[ \t\n]" t name (font-lock-function-name-face . 3))
(("stand-init:") definition-starter (font-lock-function-name-face . 1)
"[\t\n]" nil comment (font-lock-string-face . 1))
(("end-code") definition-ender (font-lock-keyword-face . 1))
(("loopa") compile-only (font-lock-keyword-face . 2))
(("fload" "fl" "in:")
non-immediate (font-lock-keyword-face . 1)
"[\n\t ]" t string (font-lock-string-face . 1))
(("\"") immediate (font-lock-string-face . 1)
"[\"\n]" nil string (font-lock-string-face . 1))
(("purpose:") immediate (font-lock-comment-face . 1)
"[\n]" nil comment (font-lock-comment-face . 1))
(("[ifndef]") immediate (font-lock-keyword-face . 2)
"[ \t\n]" t name (font-lock-function-name-face . 3))
(("/n" "/w" "/c")
non-immediate (font-lock-constant-face . 2))
(("2value" "buffer:")
non-immediate (font-lock-type-face . 2)
"[ \t\n]" t name (font-lock-variable-name-face . 3))
(("end-string-array") non-immediate (font-lock-keyword-face . 2)
"[ \t\n]" t name (font-lock-type-face . 3))
(("string-array") non-immediate (font-lock-keyword-face . 2))
("-?[0-9a-f]+\\(\\.[0-9]*e\\(-?[0-9]+\\)?\\|\\.?[0-9a-f]*\\)\\.?"
immediate (font-lock-constant-face . 3))
))
(setq forth-custom-indent-words
'((("[ifndef]")
(0 . 2) (0 . 2))
(("label")
(0 . 2) (0 . 2) non-immediate)
(("end-code")
(-2 . 0) (0 . -2) non-immediate)
(("c;")
(-2 . 0) (0 . -2) non-immediate)))
(define-key forth-mode-map "\C-h" 'backward-delete-char)
)))))
Some of the keywords mentioned above are specific to Open Firmware source, but you might find a few of interest.
from discussion.
@MitchBradley @quozl Thank you! I was able to locate it on melpa as well, so it should be easy to set it up.
And @quozl, that snippet will come in very handy indeed. Thanks again!
Cheers.
from discussion.
@MitchBradley Wow, that is quite something indeed. I must confess I don't understand most of it, but I can pick and incorporate some useful tidbits from there as I progress in Forth myself. Thank you for sharing the coniguration!
from discussion.
Related Issues (20)
- Thinking Forth
- EuroForth 2021 Invitation: 10.-12. September
- A peculiar and fun Forth like compiler targeting bash functions, recently made available. HOT 48
- Exception handling via a condition system : possible? HOT 2
- JForth reboot?
- ChatFORTH - chat with OpenAI ChatGPT with power of FORTH HOT 2
- Invitation: 39th EuroForth in Roma, 15.-17. September 2023
- ANN: Conditions and restarts in ANS Forth
- Conditionals design and implementation HOT 8
- Desktop Forth system requirements HOT 2
- Poll: preference of case-sensitivity HOT 22
- Are there any Posit implementations out there? HOT 6
- Is the bot StarForth off ? HOT 1
- Compilation JIT HOT 13
- Why Forth Isn't Slow (Forth Dimension Volume 06 Number 5) (archive.org)
- [META] GitHub Discussions are now generally available HOT 12
- Minimal set of low level words to build forth HOT 48
- Macintosh Forths
- VolksForth HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discussion.