From fe9bca1da5ba148ce85f7410167041dd34e806d1 Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Fri, 1 Jan 2021 00:00:35 +0000 Subject: [PATCH] Add GLSL language support --- config.org | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/config.org b/config.org index 48401a5..085ccfc 100644 --- a/config.org +++ b/config.org @@ -692,6 +692,49 @@ (add-hook 'zig-mode-hook #'lsp-deferred) #+end_src +** GLSL + Firstly, =glsl-mode= provides basic support: + + #+begin_src emacs-lisp + (use-package glsl-mode) + #+end_src + + It's a C-like language, so I want =bsd= code style and + =smart-tabs=. The former is easy: + + #+begin_src emacs-lisp + (add-hook 'glsl-mode-hook + (lambda () + (c-set-style "bsd") + (setq c-basic-offset 4))) + #+end_src + + Since =smart-tabs= doesn't support GLSL out of the box, we need to + add support with [[help:smart-tabs-add-language-support][smart-tabs-add-language-support]]. There's an + example of how to use it on [[https://www.emacswiki.org/emacs/SmartTabs#h5o-5][Emacs Wiki]]: + + #+begin_src emacs-lisp :tangle no + (smart-tabs-add-language-support c++ c++-mode-hook + ((c-indent-line . c-basic-offset) + (c-indent-region . c-basic-offset))) + #+end_src + + [[help:c-indent-line][c-indent-line]] et al will do fine for GLSL too since its syntax is + very similar to C's, so adding support for it looks very similar to + that example: + + #+begin_src emacs-lisp + (smart-tabs-add-language-support glsl glsl-mode-hook + ((c-indent-line . c-basic-offset) + (c-indent-region . c-basic-offset))) + #+end_src + + Now that support is added, [[help:smart-tabs-insinuate][smart-tabs-insinuate]] should do its job: + + #+begin_src emacs-lisp + (smart-tabs-insinuate 'glsl) + #+end_src + * Tool Integrations ** Docker I use docker quite a lot, unfortunately, so it's nice to be able to