HBLang mode

This commit is contained in:
Able 2024-12-04 15:52:46 -06:00
parent 8f0cb2ab5c
commit eda407ff48
2 changed files with 59 additions and 4 deletions

View file

@ -51,3 +51,57 @@
;; Set tab width, Doesn't seem to work :( ;; ;; Set tab width, Doesn't seem to work :( ;;
(setq-default tab-width 1) (setq-default tab-width 1)
;;;;;;;;;;;;;;;;;
;; Minor Modes ;;
;;;;;;;;;;;;;;;;;
(defun do-nothing ()
"Don't do anything"
(interactive))
(define-minor-mode no-backspace-mode
"Disable the backspace key"
:global t
:lighter " noBackspace")
(defvar no-backspace--emulation-alist
`((no-backspace-mode
. ,(let ((map (make-sparse-keymap)))
(define-key map (kbd "DEL") #'do-nothing)
map))))
(add-to-list 'emulation-mode-map-alists 'no-backspace--emulation-alist)
;;;;;;;;;;;;;;;;;
;; HBLang Mode ;;
;;;;;;;;;;;;;;;;;
(defvar hblang-mode-syntax-table
(let ((table (make-syntax-table)))
;; C and C++-style comments.
(modify-syntax-entry ?/ ". 124b" table)
(modify-syntax-entry ?* ". 23" table)
(modify-syntax-entry ?\n "> b" table)
;; Lisp-style comments.
;; (modify-syntax-entry ?\; "< b" table)
table)
"Syntax table for `hblang-mode'.")
(defvar hblang-font-lock-keywords
'(("[a-zA-Z]+" (1 font-lock-function-name-face))
("[a-z]" (1 font-lock-variable-name-face)))
"Highlight rules for `hblang-mode'.")
(define-derived-mode hblang-mode prog-mode "hb"
"Major mode for editing hblang files."
(setq font-lock-defaults '(hblang-font-lock-keywords nil)))
(add-to-list 'auto-mode-alist '("\\.hb\\'" . hblang-mode))
(provide 'hblang-mode)

View file

@ -21,11 +21,12 @@
;;layout ; auie,ctsrnm is the superior home row ;;layout ; auie,ctsrnm is the superior home row
:completion :completion
;;company ; the ultimate code completion backend company ; the ultimate code completion backend
(corfu +orderless) ; complete with cap(f), cape and a flying feather! (corfu +orderless) ; complete with cap(f), cape and a flying feather!
;;helm ; the *other* search engine for love and life ;;helm ; the *other* search engine for love and life
;;ido ; the other *other* search engine... ;;ido ; the other *other* search engine...
;;ivy ; a search engine for love and life ;;ivy
;;; a search engine for love and life
vertico ; the search engine of the future vertico ; the search engine of the future
:ui :ui
@ -96,7 +97,7 @@
;;ein ; tame Jupyter notebooks with emacs ;;ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls) (eval +overlay) ; run code, run (also, repls)
lookup ; navigate your code and its documentation lookup ; navigate your code and its documentation
;;lsp ; M-x vscode lsp ; M-x vscode
magit ; a git porcelain for Emacs magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs ;;make ; run make tasks from Emacs
;;pass ; password manager for nerds ;;pass ; password manager for nerds
@ -164,7 +165,7 @@
;;rest ; Emacs as a REST client ;;rest ; Emacs as a REST client
;;rst ; ReST in peace ;;rst ; ReST in peace
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
;;(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() (rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good ;;scala ; java, but good
;;(scheme +guile) ; a fully conniving family of lisps ;;(scheme +guile) ; a fully conniving family of lisps
sh ; she sells {ba,z,fi}sh shells on the C xor sh ; she sells {ba,z,fi}sh shells on the C xor