3 ms·
I suspect I encountered the same bug (in vanilla Emacs). It seems in Emacs 27 they introduced support for sql-indent-mode[1][2] which is not shipped by default
by natrys 6y ago
I suspect I encountered the same bug (in vanilla Emacs). It seems in Emacs 27 they introduced support for sql-indent-mode[1][2] which is not shipped by default but is in elpa. However there is a hook that checks if that package is installed, if so then loads it by default. It seems when not installed, somehow said hook messes things up in org-mode.
Thanks to some investigative work from Doom Emacs people[3][4], I have found that my issue was fixed by simply installing the sql-indent package. Of course you would need to make sure these settings are set to true to enable tab acting according to native mode in source code blocks:
(setq org-src-tab-acts-natively t)
(setq org-src-preserve-indentation t)
(setq org-src-fontify-natively t)
And yes, I wasn't amused by this. I had another problem with shell mode indentation in org source blocks as well. That said, while the lack of cohesion due to decentralised nature of Emacs development occasionally surfaces like this, I think it would be unfair to not mention that org-mode when not buggy - which is more often than not - makes a lot of great features accessible. For instance, it automatically connects to Postgres, runs my query fragment, and populates an org-mode table (which are awesome) with the resulting output - I find this feature invaluable.
Oh and if you are a Spacemacs user, perhaps give Doom Emacs a try.
[1] https://github.com/alex-hhh/emacs-sql-indent https://github.com/alex-hhh/emacs-sql-indent
[2] https://github.com/emacs-mirror/emacs/blob/master/etc/NEWS.27#L1141 https://github.com/emacs-mirror/emacs/blob/master/etc/NEWS.2...
[3] https://github.com/hlissner/doom-emacs/issues/3787 https://github.com/hlissner/doom-emacs/issues/3787
[4] https://github.com/alex-hhh/emacs-sql-indent/issues/96 https://github.com/alex-hhh/emacs-sql-indent/issues/96
- pdimitar 6y agoI do use Spacemacs. Do you have an advice about how to install sql-indent there? I'll find it one way or another, just wondering if you have experience. I think I can do the rest quite fine (already mastered setting those vars in Spacemacs, thankfully). As for Doom Emacs, I am mentally way too fatigued by learning new tools almost every day. :( I hear that it can be kind of like Spacemacs but it requires quite a bit more manual management which I am not a fan of. Do you have any experience confirming or refuting this impression of mine. Very thankful for the links, I'm currently going through them.
- natrys 6y agoSorry I am not a user of either. I think this might be it for Spacemacs: https://www.spacemacs.org/doc/DOCUMENTATION.html#orgheadline21 https://www.spacemacs.org/doc/DOCUMENTATION.html#orgheadline... I did try Doom Emacs though. I felt it was usable right out of the box with nice defaults. But then again I haven't used it for a serious time length (I prefer Emacs keybinding, rare I know). I also empathise with tool fatigue. I haven't significantly touched my Emacs config in a while, been in strictly bug fixing mode. That does mean I shouldn't update major version of Emacs, or the packages, but I sometimes do that anyway :/
- pdimitar 6y agoLet's hug and cry. :D Last time I blindly updated Spacemacs itself I lost an hour getting it back to a workable state, sigh. Learned my lesson since then. I do both: (a) completely back up my ~/.emacs.d to another directory and (b) write down the last-known GIT commit hash of Spacemacs. Paid off huge dividends half the time I did updates ever since. I love Emacs but it seems certain things won't ever get resolved (like macOS slow rendering although that's like 70% attributed to huge fonts with a lot of emojis in them so I got that part sorted at least). Again, thanks for the support -- much appreciated! I'll go through the links plus will try to resolve my Org Mode problem in particular -- eventually.