ablemacs/config.el

107 lines
2.4 KiB
EmacsLisp
Raw Normal View History

2024-12-03 10:37:11 -06:00
;;;;;;;;;;;;;;;;;;;;
;; File Locations ;;
;;;;;;;;;;;;;;;;;;;;
(setq org-directory "~/org-mode/")
;;;;;;;;;;;;;;;;;
;; Keybindings ;;
;;;;;;;;;;;;;;;;;
;; Cut/paste like a normal human being.
(cua-mode 1)
;; Tab key binding.
(global-set-key (kbd "TAB") #'self-insert-command)
;; Spam Ctrl + s to save.
(global-set-key (kbd "C-s") 'save-buffer)
2024-12-02 23:41:35 -06:00
2024-12-03 10:37:11 -06:00
;; Prevent backspace from turning a tab character into 4 spaces.
(setq backward-delete-char-untabify-method nil)
2024-12-02 23:41:35 -06:00
2024-12-03 10:37:11 -06:00
;;;;;;;;;;;;;;;;;;;;;
;; Display Options ;;
;;;;;;;;;;;;;;;;;;;;;
;; This theme is inspired by the atom one dark theme
(setq doom-theme 'doom-one)
;; Display line numbers the normal way.
2024-12-02 23:41:35 -06:00
(setq display-line-numbers-type t)
2024-12-03 10:37:11 -06:00
;; Display time in specific formats.
2024-12-02 23:41:35 -06:00
(setq display-time-24hr-format 1)
(setq display-time-day-and-date 1)
2024-12-03 10:37:11 -06:00
;; Enable diplaying time
2024-12-02 23:41:35 -06:00
(display-time-mode 1)
;; Restore the menu bar because doom-emacs disables it.
(defun restore-menu-bar()
(interactive)
(if (fboundp 'tool-bar-mode) (tool-bar-mode 1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode 1)))
(restore-menu-bar)
2024-12-03 10:37:11 -06:00
;; Start emacs maximized.
(add-hook 'window-setup-hook #'toggle-frame-maximized)
;; Set tab width, Doesn't seem to work :( ;;
(setq-default tab-width 1)
2024-12-04 15:52:46 -06:00
;;;;;;;;;;;;;;;;;
;; 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)
table)
"Syntax table for `hblang-mode'.")
(defvar hblang-font-lock-keywords
;; Change the "" quoted regex to do various forms of highlighting.
'(("" (1 font-lock-function-name-face))
("" (1 font-lock-variable-name-face)))
2024-12-04 15:52:46 -06:00
"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)