reddit / emacs

Keyboard direction reversed after editing a source block in org mode

popeketric · 2022-04-12 17:32
As part of my day to day work I write a lot of documentation, primarily in org-mode. Lately I've been documenting some SQL we've been using for a project, which happily opens in a separate buffer to edit, and works great. However when I save the buffer (C-c ' ) and return to the main document buffer my keyboard direction appears reversed. So far I've been unsuccessful in determining a setting or switch that might be triggered to cause this, and the only way I've had to reverse the input flow is to close and re-open emacs. What am I missing here? Update: Was running Emacs 27, and updated to 28. SQL source blocks in org mode no longer open in an external buffer, and this problem seems to be directly related to the external buffer behavior. Just odd.
NoisyFrequency · 2022-04-12 17:55
I've had the same issue earlier this year but couldn't find a solution.
Phil-Hudson · 2022-04-12 19:02
I've also experienced this in the not-too-distant past, though not in the last few weeks. Very strange to see and frustrating to deal with. A wild guess: There was a recent report of an exploit involving normally-invisible Unicode codepoints (non-printing characters) that change the direction of text from left-to-right to right-to-left and back again -- I think I heard about it on the "Security Now" podcast three or four weeks ago. I don't think this is necessarily an example, but I do wonder if those Unicode characters might somehow be responsible for what is happening.
deltille · 2022-04-12 19:37
What an incredibly odd bug. Have you already read https://www.gnu.org/software/emacs/manual/html_node/emacs/Bidirectional-Editing.html and checked the variables it mentions?
popeketric · 2022-04-12 20:21
Looking at that article, everything is as default before I move into the buffer to edit the SQL. After I edit it bidi-paragraph-direction is set to left-to-right (was nil). Changing it back to nil doesn't alter what I'm seeing. The paragraph still flows from left-to-right as before, but after I type a character the cursor repositions itself to the left of the typed character: siht ekil gnikool tuo semoc txet os
popeketric · 2022-04-12 20:22
Also, I should note, that just closing the buffer with no content in it causes the issue, so it's not something peculiar to the SQL I'm inserting itself, this just seems to be an oddity of the external buffer editor.
magthe0 · 2022-04-13 05:11
This rings a bell. Did you read this old post already? https://www.reddit.com/r/orgmode/comments/mmrx6j/weird_occasional_backwards_typing/
yantar92 · 2022-04-28 14:57
Can you reproduce from emacs -Q?