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

inner mode indentation not works on the first line after head mark #328

Open
Ziqi-Yang opened this issue Mar 29, 2023 · 0 comments
Open

Comments

@Ziqi-Yang
Copy link

Code(brief):

(defun typst-indent-line ()
  (interactive)
  (message "function executing") ;; to show whether the function is executing
  ;; do indentation
)

You can also view it on my repo: permlink
And this is the test file(part)(all comments are only added here for better present this issue):

{ # this is the inner mode head mark
let a = [from] # mark 1
let b = [*world*]
[hello ]
[
	asdf
]	
a + [ the ] +
} # this is the inner mode tail mark

mark 1: when the cursor on this line: 1. when there is no content in the previous line after '{', the function won't be executed when I hit tab, but I can correctly indent this line by manually calling my indent line function typst-indent-line; 2. when there is content in the previous line after '{', the function will be called and I have noticed that the result of (current-indentation) for previous line is the number of blank columns between { and non-blank character. However, the second scenario will fail to indent the line(hit tab), but still, a direct call to tyspt-indent-line works.
This is my inner mode definition

(define-innermode typst--poly-code-innermode
  :mode 'typst--code-mode
  :head-matcher "\\(^{\\|[^\\]{\\)"
  :tail-matcher "\\(^}\\|[^\\]}\\)"
  :head-mode 'host
  :tail-mode 'host)
@Ziqi-Yang Ziqi-Yang changed the title inner mode indentation issue inner mode indentation not works on the first line after head mark Mar 29, 2023
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