Update cc-mode

This commit is contained in:
Marcus Kammer 2024-02-05 14:40:28 +01:00
parent 75eb5f9286
commit b55c1c77ab

View file

@ -54,38 +54,41 @@
(setq sql-mariadb-options '("-C" "-t" "-f" "-n")) (setq sql-mariadb-options '("-C" "-t" "-f" "-n"))
(setq sql-mysql-options '("-C" "-t" "-f" "-n")))) (setq sql-mysql-options '("-C" "-t" "-f" "-n"))))
;; (use-package cc-mode (use-package cc-mode
;; :defer t :defer t
;; ;; https://www.gnu.org/prep/standards/html_node/Writing-C.html :ensure nil
;; :ensure nil :hook (c-mode-common . c-toggle-auto-newline)
;; ;; :hook (c-mode . eglot-ensure) :custom
;; :hook (c-mode-common . c-toggle-auto-newline) (fill-column 79)
;; :custom (c-basic-offset 2))
;; (fill-column 79) ; according to gnu style guide
;; (c-basic-offset 2) ; "" (defun me/c-mode-style-hook ()
;; :config ;; https://www.gnu.org/prep/standards/html_node/Writing-C.html
;; (defun me/c-mode-style-hook () ;; if linux kernel source use linux style, else use gnu style
;; ;; if linux kernel source use linux style, else use gnu style (c-set-style
;; (c-set-style (if (and (buffer-file-name)
;; (if (and (buffer-file-name) (string-match "/usr/src/linux" (buffer-file-name)))
;; (string-match "/usr/src/linux" (buffer-file-name))) "linux"
;; "linux" "gnu")))
;; "gnu")))
;; (add-hook 'c-mode-common-hook 'me/c-mode-style-hook)) (add-hook 'c-mode-common-hook 'me/c-mode-style-hook)
;; (defun me/c-mode-compile-command-hook () ;; (defun me/c-mode-compile-command-hook ()
;; ;; if no makefile use gcc for compile command ;; ;; if no makefile use gcc for compile command
;; (unless (or (file-exists-p "makefile") ;; (unless (or (file-exists-p "makefile")
;; (file-exists-p "Makefile")) ;; (file-exists-p "Makefile"))
;; (set (make-local-variable 'compile-command) ;; (set (make-local-variable 'compile-command)
;; (concat "gcc " "-Wall " "-g " buffer-file-name " -o " ;; (concat "gcc " "-Wall " "-g " buffer-file-name " -o "
;; (file-name-sans-extension buffer-file-name))))) ;; (file-name-sans-extension buffer-file-name)))))
;; (add-hook 'c-mode-common-hook 'me/c-mode-compile-command-hook) ;; (add-hook 'c-mode-common-hook 'me/c-mode-compile-command-hook)
;; (defun me/c-mode-compile-on-save () ;; (defun me/c-mode-compile-on-save ()
;; ;; compile on save hook ;; ;; compile on save hook
;; (make-local-variable 'after-save-hook) ;; (make-local-variable 'after-save-hook)
;; (add-hook 'after-save-hook (lambda () (compile compile-command)))) ;; (add-hook 'after-save-hook (lambda () (compile compile-command))))
;; (add-hook 'c-mode-common-hook 'me/c-mode-compile-on-save))
;; (add-hook 'c-mode-common-hook 'me/c-mode-compile-on-save)
;; (use-package js-mode ;; (use-package js-mode
;; :ensure nil ;; :ensure nil