Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I prevent adding a TAB if inner block is already aligned, in pine-script-mode? #17

Open
avatar-lavventura opened this issue Jan 4, 2023 · 0 comments

Comments

@avatar-lavventura
Copy link

I am using pine-script-mode with a 4 space TAB. Here is an inner block of an if statement that is already aligned. How can I prevent adding a TAB char (or 4 space chars) when I press TAB?

pine file:

if x == 1
    line1_x = 100
    line2_x = 110

Here when cursor is at the beginning of the line1_x or line2_x lines and I press TAB it adds 4 spaces. Instead, since it is already aligned I want it to do nothing.


basic emacs config file:

(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/"))
(package-initialize)
(fset 'yes-or-no-p 'y-or-n-p)

(use-package pine-script-mode
  :ensure t
  :pin melpa-stable
  :mode (("\\.pine" . pine-script-mode)))

(defun pine-custom-settings ()
  (setq indent-tabs-mode nil)
  (setq tab-width 4))

(defun c/pinescript-indent ()
  "Just do dumb indentation rather than emacs' relative indentation."
  (setq indent-tabs-mode nil)
  (setq tab-width 4)  ; this can be omitted if standard-indent is 4
  (setq indent-line-function 'insert-tab))

(add-to-list 'indent-line-ignored-functions 'insert-tab)
(add-hook 'pine-script-mode-hook 'c/pinescript-indent)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant