From 092304d9e0ccc37cc0ddaa9b136457e56a1cac20 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 12 Oct 2025 11:47:26 -0500 Subject: changing repositories --- modules/prog-c.el | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 modules/prog-c.el (limited to 'modules/prog-c.el') diff --git a/modules/prog-c.el b/modules/prog-c.el new file mode 100644 index 00000000..4dc4c5af --- /dev/null +++ b/modules/prog-c.el @@ -0,0 +1,32 @@ +;;; prog-c --- C Programming Settings and Functionality -*- lexical-binding: t; coding: utf-8; -*- +;; author Craig Jennings + +;;; Commentary: + +;;; Code: + +;;;; ------------------------------ C-Mode Settings ------------------------------ + +(defun cj/c-mode-settings () + "Settings for \='c-mode\='." + (setq-default indent-tabs-mode nil) ;; spaces, not tabs + (setq-default c-basic-offset 4) ;; 4 spaces offset + (setq c-default-style "stroustrup") ;; k&r c, 2nd edition + (setq c-basic-indent 4) ;; indent 4 spaces + (setq compile-command "CFLAGS=\"-Wall -g \" make ") ;; default make command + (setq display-line-numbers-type t) ;; disable relative line numbers in C + (setq comment-auto-fill-only-comments t) ;; only auto-fill inside comments + (auto-fill-mode) ;; auto-fill multiline comments + (electric-pair-mode)) ;; automatic parenthesis pairing +(add-hook 'c-mode-common-hook 'cj/c-mode-settings) + +;;;; -------------------------- Keybindings -------------------------- + +(add-hook 'c-mode-common-hook (lambda () + (local-set-key (kbd "S-") #'compile) + (local-set-key (kbd "S-") #'gdb))) + + + +(provide 'prog-c) +;;; prog-c.el ends here -- cgit v1.2.3