-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Unexpected behaviour from evil-org-open-below inside org code blocks #13465
Comments
I experience the same problem. It seems like this only happens on develop and not on master though. |
ConfirmedWith the cursor in a bash, org src block
Pressing either:
opens: The messages buffer shows:
But with a emacs-lisp, org src block
master branchIt doesn't happen on the spacemacs/layers/+emacs/org/local/evil-org/evil-org.el Lines 136 to 137 in c7a103a
o calls the anonymous function,but O is rebound in the org/init-evil-org function (which is defined after the local bindings) to call: evil-open-above spacemacs/layers/+emacs/org/packages.el Lines 55 to 56 in d46eacd
Pressing And the messages buffer shows:
Windows 1903#### System Info :computer: - OS: windows-nt - Emacs: 26.3 - Spacemacs: 0.300.0 - Spacemacs branch: develop (rev. 1f6e39ea8) - Graphic display: t - Distribution: spacemacs - Editing style: vim - Completion: helm - Layers: ```elisp (autohotkey auto-completion command-log dap emacs-lisp git helm html imenu-list javascript (markdown :variables markdown-live-preview-engine 'vmd markdown-command "vmd") multiple-cursors nim (org :variables org-agenda-files '("~/org/notes.org")) (shell :variables shell-default-shell 'shell shell-default-height 30 shell-default-position 'bottom) spell-checking (syntax-checking :variables syntax-checking-enable-by-default nil) treemacs version-control) ``` - System configuration features: XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS THREADS LCMS2 |
This seems to be what's causing the spacemacs/layers/+emacs/org/packages.el Line 130 in 1f6e39e
The variable can be disabled from the (org :variables org-src-tab-acts-natively nil) Or from the (setq org-src-tab-acts-natively nil) Then restart Spacemacs.
|
Thank you so much @duianto - issue is fixed! |
@duianto |
Well, I'm not able to find a way to determine whether the cursor is within a block. ( Otherwise I can fix it. |
It's unexpected. It seems to be caused by some setting or package in Spacemacs, because there are no completion suggestions with Emacs,
It doesn't seem to be caused by the variable:
It not
|
It looks like ((and (eq type 'src-block)
org-src-tab-acts-natively
(> (line-beginning-position)
(org-element-property :post-affiliated element))
(< (line-beginning-position)
(org-with-point-at (org-element-property :end element)
(skip-chars-backward " \t\n")
(line-beginning-position))))
(org-babel-do-key-sequence-in-edit-buffer (kbd "TAB"))) I'm still new to this, so it's not entirely clear to me why (org-babel-do-key-sequence-in-edit-buffer (kbd "TAB")) is the most sensible thing to do in this situation, but given that that's how it's written, your suggestion to disable The completion behavior is likely related to #4478. It seems unexpected given that |
(when evil-auto-indent
(indent-according-to-mode)) This opens
(funcall indent-line-function) In As pointed out previously, when (> (line-beginning-position)
(org-element-property :post-affiliated element)) This returns true if the cursor is after the beginning of (< (line-beginning-position)
(org-with-point-at (org-element-property :end element)
(skip-chars-backward " \t\n")
(line-beginning-position)))) This returns true when the cursor is before the last character of So in other word, as long as the cursor is within the source block and the
That is trigger the binding of |
One way to circumvent this is to bind A even better solution is, use the method similar to how |
The reason why it isn't happening without Spacemacs seems to be because,
This can be seen by evaluating
The
|
Well, I think we need to fix this on spacemacs's end because org/evil-org are working perfectly fine. That's I propose to bind |
Agree |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
I've looked into this and I'm quite confused as to how plain org mode plus evil deal with this. The issue here is
as well as changing
|
I think you're talking about a different issue here... |
@lebensterben What? Opening new lines in shell source code blocks in |
Because I think now the issue is |
@lebensterben Yes, which at some point ends up calling From what I can understand, all those steps are needed and make sense except hardcoding the overloading of |
See syl20bnr/spacemacs#13465 for description.
I don't know if it's useful comment but what's happening is that the sending of TAB in the org-src-edit buffer is hitting the normal mode instead of the insert mode of evil. That's what's creating the discrepancy in mapping as highlighted by @duianto here: #13465 (comment) I couldn't find a better way than this to work around it:
I wish there would be something less radical. |
Some default hook was overriding setq org-src-tab-acts-natively to 1 when I loaded org-mode every time. The following line in your .spacemacs user-config() will fix this for anyone who encounters it: |
Description
Unexpected behaviour from evil-org-open-below inside org code blocks.
Reproduction guide 🪲
Observed behaviour: 👀 💔
Expected behaviour: ❤️ 😄
System Info 💻
The text was updated successfully, but these errors were encountered: