https://github.com/vkazanov/quakec-mode
Emacs major mode for QuakeC development
https://github.com/vkazanov/quakec-mode
emacs modding quake quakec
Last synced: over 1 year ago
JSON representation
Emacs major mode for QuakeC development
- Host: GitHub
- URL: https://github.com/vkazanov/quakec-mode
- Owner: vkazanov
- License: gpl-3.0
- Created: 2023-05-10T17:05:59.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-19T09:47:39.000Z (about 3 years ago)
- Last Synced: 2025-03-15T01:47:49.255Z (over 1 year ago)
- Topics: emacs, modding, quake, quakec
- Language: Emacs Lisp
- Homepage:
- Size: 242 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
* Emacs major mode for QuakeC files
=quakec-mode= provides support for the original Quake 1 extension language, as well as
some popular extensions provided by the FTEQCC and GMQCC compilers. In addition to qc
code itself, a bundled =quakec-progs-mode= supports editing traditions src files.
Features:
- QuakeC syntax
- progs.src syntax highlighting
- imenu support
- xref-based definition lookups
- ElDoc inline help for known defintions
- completion-at-point backend for known definition
- compilation mode support
- which-function support
In other words, this is your typical Emacs major-mode.
* A QuakeC project as seen by quakec-mode
=quakec-mode= understands QuakeC mode projects as a directory containing a file
specified in the =quakec-project-source= variable (=progs.src= by default).
* Compiling with compilation-mode
QuakeC includes compilation diagnostic message highlighting for =FTEQCC= and =GMQCC=.
Custom compilation commands are provided in the mode map: =quakec-compile= (=C-c C-c=)
and =quakec-recompile= (=C-c C-r=). Custom compilation commands always run from the
QuakeC project root defined by the =quakec-project-source= file.
* Completion and definition lookups
The default =completion-at-point= backend (provided by =quakec-completion-at-point=)
loads definitions from the current buffer and a few additional files listed in
=quakec-project-definition-files= variable (=defs.qc= and =world.qc= by default).
For best experience it makes sense to use an additional completion frontend such as
=company-mode=.
* Flymake
Partial support for error highlighting with Flyamke by FTEQCC / GMQCC is provided. Its
usefulness is limited because of how both compilers don't support limiting compilation
errors to a single file and always try to compile the full project. Most of the time
this means that errors will only be shown for files listed early in the =progs.src=
file.
Flymake support can be added by running =(quakec-setup-flymake-fteqcc-backend)= or
=(quakec-setup-flymake-gmqcc-backend)= followed by the usual =(flymake-mode 1)=.
* Setup
Example setup:
#+begin_src emacs-lisp
(defun my-quakec-mode-hook ()
;; typical QuakeC conventions (makes sense to set through
;; .dir-locals.el files)
(setq-local indent-tabs-mode t)
(setq-local tab-width 4)
;; Company mode backend to for completion-at-point for local
;; definition
;; (setq-local company-backends '(company-capf))
;; Limited Flymake support for error/warning inline highlighting
;; (quakec-setup-flymake-fteqcc-backend)
;; (flymake-mode 1)
)
(use-package quakec-mode
;; drop the quakec-mode.el somewhere (or just install from MELPA)
:load-path "path/to/quakec-mode"
;; run our configration
:hook (quakec-mode . my-quakec-mode-hook))
#+end_src
* Reference
- Classic [[https://pages.cs.wisc.edu/~jeremyp/quake/quakec/quakec.pdf][QuakeC reference manual]]
- [[https://www.fteqcc.org/dl/fteqcc_manual.txt][FTEQCC manual]], a popular QuakeC compiler
- [[https://graphitemaster.github.io/gmqcc/][GMQCC manual]], a deeply modernised standalone QuakeC compiler
- [[https://github.com/id-Software/Quake-Tools/tree/master/qcc][QCC]], the original QuakeC compiler, complete with all the bugs