.emacs.d

My Emacs configuration files.
Log | Files | Refs | README

commit 84b0e66e47e2e1cd921602dfff14afa5807d03c8
parent 7a48c6a9dcb75dff464a59dc7af7d6688612f88f
Author: Hugo Soucy <hsoucy@kronostechnologies.com>
Date:   Mon, 28 May 2018 09:42:44 -0400

Add a hack to have a better indenting in lua-mode.

But it dosen't work.

Diffstat:
Mpartials/lua.el | 23++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/partials/lua.el b/partials/lua.el @@ -1,4 +1,25 @@ (use-package lua-mode ;; a major-mode for editing Lua scripts. :ensure t - :pin melpa) + :pin melpa + :config + ;; Fixing indentation of lua (busted) in emacs. A nasty hack + (defun lua-busted-fuckups-fix () + (save-excursion + (lua-forward-line-skip-blanks 'back) + (let* ((current-indentation (current-indentation)) + (line (thing-at-point 'line t)) + (busted-p (s-matches? + (rx (+ bol (* space) + (or "context" "describe" "it" "setup" "teardown") + "(")) + line))) + (when busted-p + (+ current-indentation lua-indent-level))))) + + (defun rgc-lua-calculate-indentation-override (old-function &rest arguments) + (or (lua-busted-fuckups-fix) + (apply old-function arguments))) + + (advice-add #'lua-calculate-indentation-override + :around #'rgc-lua-calculate-indentation-override))