Updates with concepts from Fuzzy and Z80 mode

This commit is contained in:
William Moore 2024-07-15 16:06:52 -05:00
parent e16c8fba0c
commit 3fa3e55e6e
5 changed files with 92 additions and 13 deletions

1
.gitignore vendored
View File

@ -9,6 +9,7 @@ org-roam.db
scratch
.emacs.desktop
custom-*.el
ede-projects.el
recentf
.cache*
.lsp*

26
init.el
View File

@ -1,9 +1,3 @@
(setq custom-init "~/.emacs.d/custom-init.el")
(unless (file-exists-p custom-init)
(dired-create-empty-file custom-init))
(load-file custom-init)
;; custom set stuff
(custom-set-variables
;; custom-set-variables was added by Custom.
@ -16,14 +10,26 @@
'(tool-bar-mode nil)
'(visible-bell 1))
(setq custom-file "~/.emacs.d/custom-config.el")
(unless (file-exists-p custom-file)
(dired-create-empty-file custom-file))
(load custom-file)
(global-ede-mode t)
;; whomp helpers
(require 'whomp-helpers)
(setq custom-init "~/.emacs.d/custom-init.el")
(unless (file-exists-p custom-init)
(whomp/ensure-file-exists custom-init))
(load-file custom-init)
(setq custom-file "~/.emacs.d/custom-config.el")
(unless (file-exists-p custom-file)
(whomp/ensure-file-exists custom-file))
(load custom-file)
;; whomp config
(require 'whomp-configuration)
;; whomp defaults

View File

@ -16,6 +16,7 @@
(const :tag "yaml" yamlmode) ;; yaml language support
(const :tag "rainbow-delimiters" rainbowmode) ;; rainbow-delimiters support
(const :tag "terraform" terraformmode) ;; terraform language support
(const :tag "z80" z80mode) ;; z80 assembly language support
)
:group 'whomp-config)
@ -113,9 +114,17 @@
;; rainbow-delimiters-mode
(when (memq 'rainbowmode whomp-development)
(straight-use-package 'rainbow-delimiters)
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
(message "rainbow-delimiters-mode loaded"))
(use-package rainbow-delimiters
:straight t
:defer t
:config
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
(message "rainbow-delimiters-mode loaded")))
;; z80-mode
(when (memq 'z80mode whomp-development)
(load "~/.emacs.d/whomp/z80-mode.el")
(message "z80-mode loaded"))
(message "W.H.O.M.P. development assistance packages loaded")
(provide 'whomp-development)

View File

@ -65,6 +65,11 @@ all `.org` files in the `~/.org-agenda` directory, and sets
(setq org-timeblock-files (whomp/list-files-with-extension "~/org/agenda" "org"))
(setq org-timeblock-inbox-file "~/org/agenda/index.org"))
;; Function to provide for creating files
(defun whomp/ensure-file-exists (file-path)
"Touch a file to existence."
(shell-command (concat "touch " file-path)))
(message "W.H.O.M.P. Loaded helper function library.")
(provide 'whomp-helpers)

58
whomp/z80-mode.el Normal file
View File

@ -0,0 +1,58 @@
;;; z80-mode.el --- a simple package
;; Copyright (C) 2011 Tanner Hobson (_player1537)
;; Author: Tanner Hobson
;; Keywords: z80 assembly
;; Version: 1.0.0
(defvar z80-mode-hook nil)
(defvar z80-mode-map
(let ((map (make-keymap)))
(define-key map (kbd "C-j") 'newline-and-indent)
;;(define-key map (kbd "RET") 'newline-and-indent)
map)
"Keymap for z80 major mode")
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.z80\\'" . z80-mode))
(defconst z80-font-lock-keywords-1
(list
'("\\<\\(ADC\\|ADD\\|AND\\|BIT\\|CALL\\|CCF\\|CP\\|CPD\\|CPDR\\|CPIR\\|CPI\\|CPL\\|DAA\\|DEC\\|DI\\|DJNZ\\|EI\\|EX\\|EXX\\|HALT\\|IM\\|IN\\|INC\\|IND\\|INDR\\|INI\\|INIR\\|JP\\|JR\\|LD\\|LDD\\|LDDR\\|LDI\\|LDIR\\|NEG\\|NOP\\|MLT\\|OR\\|OTDM\\|OTDMR\\|OTDR\\|OTIM\\|OTIMR\\|OTIR\\|OUT\\|OUTD\\|OUTI\\|POP\\|PUSH\\|RES\\|RET\\|RETI\\|RETN\\|RL\\|RLA\\|RLC\\|RLCA\\|RLD\\|RR\\|RRA\\|RRC\\|RRCA\\|RRD\\|RST\\|SBC\\|SCF\\|SET\\|SLA\\|SLP\\|SRA\\|SRL\\|SUB\\|TST\\|TSTIO\\|XOR\\|adc\\|add\\|and\\|bit\\|call\\|ccf\\|cp\\|cpd\\|cpdr\\|cpir\\|cpi\\|cpl\\|daa\\|dec\\|di\\|djnz\\|ei\\|ex\\|exx\\|halt\\|im\\|in\\|inc\\|ind\\|indr\\|ini\\|inir\\|jp\\|jr\\|ld\\|ldd\\|lddr\\|ldi\\|ldir\\|neg\\|nop\\|mlt\\|or\\|otdm\\|otdmr\\|otdr\\|otim\\|otimr\\|otir\\|out\\|outd\\|outi\\|pop\\|push\\|res\\|ret\\|reti\\|retn\\|rl\\|rla\\|rlc\\|rlca\\|rld\\|rr\\|rra\\|rrc\\|rrca\\|rrd\\|rst\\|sbc\\|scf\\|set\\|sla\\|slp\\|sra\\|srl\\|sub\\|tst\\|tstio\\|xor\\|A\\|B\\|C\\|D\\|E\\|H\\|L\\|AF\\|BC\\|DE\\|HL\\|IX\\|IY\\|SP\\|PC\\|a\\|b\\|c\\|d\\|e\\|h\\|l\\|af\\|bc\\|de\\|hl\\|ix\\|iy\\|sp\\|pc\\|\\|NC\\|C\\|M\\|nc\\|c\\|m\\|Z\\|z\\|NZ\\|nz\\|\\|[Pp]\\([Oo]*\\|[Ee]*\\)\\|BCALL\\|bcall\\)\\>" . font-lock-builtin-face)
'("\\(\\w*:\\)" . font-lock-variable-name-face))
"Minimal highlighting expressions for z80 mode")
(defconst z80-font-lock-keywords-2
(append z80-font-lock-keywords-1
(list
'("\\<\\(\\([0-9][0-9A-Fa-f]*[Hh]\\|\\(0[Xx]\\|[0-9]\\|\\$[0-9A-Fa-f]\\)[0-9A-Fa-f]*\\)\\|[01][01]*[Bb]\\|%[01][01]*\\|[0-9]*\\)\\>" . font-lock-constant-face)
'("\\(\\$\\)" . font-lock-function-name-face)))
"Additional Keywords to highlight in z80 mode")
(defconst z80-font-lock-keywords-3
(append z80-font-lock-keywords-2
(list
'("\\(\\.\\w*\\|#\\w*\\)" . font-lock-preprocessor-face)))
"Balls-out highlighting in z80 mode")
(defvar z80-font-lock-keywords z80-font-lock-keywords-3
"Default highlighting expressions for z80 mode")
(defvar z80-mode-syntax-table
(let ((st (make-syntax-table)))
(modify-syntax-entry ?_ "w" st)
(modify-syntax-entry ?# "w" st)
(modify-syntax-entry ?. "w" st)
(modify-syntax-entry ?\; "<" st)
(modify-syntax-entry ?\n ">" st)
(modify-syntax-entry ?\t "-" st)
st)
"Syntax table for z80-mode")
(defun z80-mode ()
"Major mode for editing Zilog Z80 ASM files"
(interactive)
(kill-all-local-variables)
(set-syntax-table z80-mode-syntax-table)
(use-local-map z80-mode-map)
(set (make-local-variable 'font-lock-defaults) '(z80-font-lock-keywords))
(setq major-mode 'z80-mode)
(setq mode-name "Z80")
(run-hooks 'z80-mode-hook))
(provide 'z80-mode)