Open anonimitoraf opened 3 months ago
I'm surprised by your second example as I don't think Symex does any indentation in insert mode. Could you try disabling Symex and just enabling paredit-mode in your Typescript buffer? Is the behavior any different?
Assuming the behavior is due to the use of paredit (which is used by Symex in insert mode), take a look at #84 as that is related and may resolve this issue when it's addressed. It also contains a link to a workaround, which should be slightly modified now -- this would replace the corresponding line in symex-enter-mode
:
(when (member major-mode (symex-get-lisp-modes)
(symex--ensure-minor-mode))
Does that help?
Sorry for the late response.
Could you try disabling Symex and just enabling paredit-mode in your Typescript buffer
Yep, same behaviour, so looks like paredit does cause it.
As you've suggested, I patched symex-enter-mode
to be:
(defun symex-enter-mode ()
"Take necessary action upon symex mode entry."
(when (member major-mode (symex-get-lisp-modes)
(symex--ensure-minor-mode))
(symex--adjust-point-on-entry)
(when symex-remember-branch-positions-p
(symex--clear-branch-memory))
(symex-select-nearest)
(when symex-refocus-p
;; smooth scrolling currently not supported
;; may add it back in the future
(symex--set-scroll-margin))
(symex--enter-mode)))
The behaviour didn't change. Is this what you meant?
@anonimitoraf Yeah, that looks right! Did you close and reopen the buffer after making the change? Or restarting Emacs to be extra sure?
The only places in the code I see symex-mode
being enabled are in symex-enter
and via major mode hooks for all "Lisp" modes, which Typescript is not, so I would expect the above patch to suffice. You could try a few things to validate some assumptions:
(symex-get-lisp-modes)
in iELM. It should only show actual Lisp modes, and Typescript mode (or whatever the major mode is for typescript buffers) should not be presentC-h v symex-mode
? After patching it as you did above (and e.g. after an Emacs restart), I would expect this value to be nil
.paredit-mode
, C-h v paredit-mode
? It should be nil
as well, since Symex uses paredit functionality but does not enable paredit mode. If this mode is active, it's likely that there's something in your config that has enabled it.Lmk if those assumptions hold up or if there's something unexpected there.
Hi @countvajhula, I'm a bit confused. I'd like to use symex
for Typescript files, but just without the auto-format/auto-indent and without the extra spaces when adding parents.
I've noticed that:
paredit
and symex
disabled = no issueparedit
disabled and symex
enabled = has issueSo there are two meanings of “mode” here. The variable “Symex-mode” refers to a minor mode that affects insert mode/“state”, specifically parentheses, by directly using paredit functions. This minor mode does not do anything else. The other meaning of mode is the modal interface used to edit code, which does not affect insert mode operations. You can use the latter without the former, and in this case, that’s what you’d like to do.The above steps should give us a clue as to whether, in your typescript buffer, it is Symex minor mode that is active or if it is paredit that is active (unbeknownst to you). Depending on that, we can debug further.Sent from my iPhoneOn Jul 20, 2024, at 2:04 AM, Rafael Nicdao @.***> wrote: Hi @countvajhula, I'm a bit confused. I'd like to use symex for Typescript files, but just without the auto-format/auto-indent and without the extra spaces when adding parents. I've noticed that:
paredit and symex disabled = no issue paredit disabled and symex enabled = has issue
Peek 2024-07-20 19-02.webm
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
Thanks for explaining! What i've observed is: symex-mode causes the issue while paredit-mode is disabled.
I'll check why symex-mode keeps getting activated for TS files and find a way to disable it then
Sounds good! For now, I've gone ahead and committed the workaround we discussed into the master branch, since it seems like we generally don't want paren balancing behavior in tree-sitter buffers. Please let me know if your investigation reveals any new information, or if the issue is resolved after upgrading.
P.S. I also noticed there was a typo in the workaround in my previous comment -- it could be that that was the problem. Anyhow, please let me know either way, and thanks!
Hi!
I've noticed (particular with Typescript) that symex does some auto-formatting when I parentheses while in
evil
INSERT mode.https://github.com/drym-org/symex.el/assets/15933322/95e0e582-3158-4f60-a959-5057c90bbfa5
To reproduce, insert parentheses after
partition
and afterf
in this snippet:Is there a way to completely disable formatting?