-
-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
Issue
gdscript-use-tab-indents does not make gdformat use spaces instead of tabs.
Fix
Changes in code
I think i fixed it. Here is my version of gdscript-comint-gdformat--run function:
(defun gdscript-comint-gdformat--run (arguments)
"Run gdformat in comint mode.
ARGUMENTS are command line arguments for gdformat executable.
When run it will kill existing process if one exists."
(let ((buffer-name (gdscript-util--get-gdformat-buffer-name))
(inhibit-read-only t))
(when (not (executable-find gdscript-gdformat-executable))
(error "Error: Could not find %s on PATH. Please customize the gdscript-gdformat-executable variable" gdscript-gdformat-executable))
(with-current-buffer (get-buffer-create buffer-name)
(unless (derived-mode-p 'gdformat-mode)
(gdformat-mode)
(buffer-disable-undo))
(erase-buffer)
(let* ((line-length (list (format "--line-length=%s" gdscript-gdformat-line-length)))
(indent-mode-arg (and (not gdscript-use-tab-indents) (list (format "-s %s" gdscript-indent-offset))))
(buffer (comint-exec (current-buffer) buffer-name gdscript-gdformat-executable nil (append line-length indent-mode-arg arguments))))
(set-process-sentinel (get-buffer-process buffer) 'gdscript-comint-gdformat--sentinel)
buffer))))I added (indent-mode-arg (and (not gdscript-use-tab-indents) (list (format "-s %s" gdscript-indent-offset)))), and then appended it to comint-exec arguments.
Documentation
If gdscript-use-tab-indents is nil, it uses gdscript-indent-offset as a number of desired spaces, utilizing gdformat's -s --use-spaces=<int> option.
Examples
Using tabs
(setq gdscript-use-tab-indents t)This configuration will call gdformat *some-args* *buffer-name*.
Using spaces
(setq gdscript-use-tab-indents nil)
(setq gdscript-indent-offset 4)This configuration will call gdformat *some-args* -s 4 *buffer-name*, where 4 is a value of gdscript-indent-offset.
Metadata
Metadata
Assignees
Labels
No labels